From baae82b9588f7967a4a4225076bcfdf0a0fa013e Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Sun, 22 Sep 2019 12:01:24 +0200 Subject: [PATCH] bla --- frontend/www/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/www/index.ts b/frontend/www/index.ts index 1373558..d512eb1 100644 --- a/frontend/www/index.ts +++ b/frontend/www/index.ts @@ -47,8 +47,7 @@ const GL = CANVAS.getContext("webgl"); var ms_per_frame = 500; -resizeCanvasToDisplaySize(GL.canvas); -GL.viewport(0, 0, GL.canvas.width, GL.canvas.height); +resizeCanvasToDisplaySize(CANVAS); GL.clearColor(0, 0, 0, 0); GL.clear(GL.COLOR_BUFFER_BIT); @@ -273,16 +272,15 @@ export async function set_instance(source: string) { ); } - CANVAS.width = CANVAS.getBoundingClientRect().width; - CANVAS.height = CANVAS.getBoundingClientRect().height; + resizeCanvasToDisplaySize(CANVAS); + game_instance = new GameInstance(Game.new(source), meshes.slice(1), meshes[0]); set_loading(false); } window.addEventListener('resize', function() { - CANVAS.width = CANVAS.getBoundingClientRect().width; - CANVAS.height = CANVAS.getBoundingClientRect().height; + resizeCanvasToDisplaySize(CANVAS); if (game_instance) { game_instance.on_resize();