Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name StarBreak: Infinite Browser Zoom-out
- // @namespace http://invalid.domain/
- // @version 0.1
- // @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.
- // @author ww
- // @match https://*.starbreak.com/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- let resizeGame = () => {
- let w = window.innerWidth,// < 5120 ? window.innerWidth : 5120, // artificial max size? not very necessary
- h = window.innerHeight;// < 5120 ? window.innerHeight : 5120;
- Module.setCanvasSize(w, h);
- Module.ctx.viewport(0, 0, w, h);
- };
- let waitForModule = () => {
- if (typeof Module === 'undefined' || typeof Module.canvas === 'undefined' || typeof Module.ctx === 'undefined') {
- setTimeout(waitForModule, 100);
- return;
- } else {
- window.addEventListener("resize", resizeGame);
- resizeGame();
- }
- };
- waitForModule();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement