From a8890e48b67bb184bcf9efe8b4dbc1bcb09d5901 Mon Sep 17 00:00:00 2001 From: Antonio Vivace Date: Sun, 15 Dec 2024 22:48:51 +0100 Subject: [PATCH] nes: fix canvas initial size --- plugins/Nes.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/Nes.vue b/plugins/Nes.vue index bc7a6dfa90..850ac1c2cd 100644 --- a/plugins/Nes.vue +++ b/plugins/Nes.vue @@ -4,8 +4,13 @@

Click here to start the emulation

-
- +
+
@@ -70,8 +75,8 @@ export default { gamerom: null, fps: 60, ticks: 0, - height: 432, - width: 480, + height: 240, + width: 256, loaded: false, loadedFile: null, paused: false, @@ -511,12 +516,13 @@ class WebGLRenderer { const gl = (this.gl = el.getContext("webgl2", { preserveDrawingBuffer: true, })); + console.log(gl); if (gl === null) { throw new Error("unable to create webgl context"); } - const w = SCREEN_WIDTH / 256; - const h = SCREEN_HEIGHT / 256; + const w = 256 / 256; + const h = 240 / 256; const buffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buffer); gl.bufferData( @@ -651,7 +657,7 @@ class WebGLRenderer { /* Fill the available space */ width: 100%; - /* Original resolution ratio */ + /* Original resolution ratio */ aspect-ratio: 256 / 240; margin: 0; /* binjgb */