Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. // ==UserScript==
  2. // @name StarBreak: Infinite Browser Zoom-out
  3. // @namespace http://invalid.domain/
  4. // @version 0.1
  5. // @description Automatically scale game to size of window. Use browser's built-in zoom-out to increase game real estate. Changing resolution with in-game settings will only remain until window gets resized/maximized.
  6. // @author ww
  7. // @match https://*.starbreak.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. let resizeGame = () => {
  15. let w = window.innerWidth,// < 5120 ? window.innerWidth : 5120, // artificial max size? not very necessary
  16. h = window.innerHeight;// < 5120 ? window.innerHeight : 5120;
  17. Module.setCanvasSize(w, h);
  18. Module.ctx.viewport(0, 0, w, h);
  19. };
  20.  
  21. let waitForModule = () => {
  22. if (typeof Module === 'undefined' || typeof Module.canvas === 'undefined' || typeof Module.ctx === 'undefined') {
  23. setTimeout(waitForModule, 100);
  24. return;
  25. } else {
  26. window.addEventListener("resize", resizeGame);
  27. resizeGame();
  28. }
  29. };
  30.  
  31. waitForModule();
  32. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement