From d52156c48ada7d1aa126d84425e3405edc9e524f Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sat, 3 Aug 2024 14:47:25 -0400 Subject: [PATCH] chore: remove unnecessary conversions --- src/platform/glfw/monitor.ts | 2 +- src/platform/glfw/window.ts | 38 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/platform/glfw/monitor.ts b/src/platform/glfw/monitor.ts index 0c85f19..bcc9069 100644 --- a/src/platform/glfw/monitor.ts +++ b/src/platform/glfw/monitor.ts @@ -96,7 +96,7 @@ export class MonitorGlfw extends DwmMonitor { modes.push( readVideoMode( Deno.UnsafePointer.create( - BigInt(Deno.UnsafePointer.value(ptr)) + BigInt(i) * 24n, + Deno.UnsafePointer.value(ptr) + BigInt(i) * 24n, ), ), ); diff --git a/src/platform/glfw/window.ts b/src/platform/glfw/window.ts index 7932243..301e78d 100644 --- a/src/platform/glfw/window.ts +++ b/src/platform/glfw/window.ts @@ -232,7 +232,7 @@ const cursorPosCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, x, y) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { const lastX = window._inputState.mouseX; const lastY = window._inputState.mouseY; @@ -288,7 +288,7 @@ const windowPosCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, x, y) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowMoveEvent(window, x, y)); } @@ -301,7 +301,7 @@ const windowSizeCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, width, height) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowResizeEvent(window, width, height)); } @@ -314,7 +314,7 @@ const windowCloseCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { if (dispatchEvent(new WindowCloseEvent(window))) { window.close(); @@ -329,7 +329,7 @@ const windowRefreshCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowRefreshEvent(window)); } @@ -342,7 +342,7 @@ const windowFocusCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, focused) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowFocusEvent(window, !!focused)); } @@ -355,7 +355,7 @@ const windowIconifyCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, iconified) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowMinimizeEvent(window, !!iconified)); } @@ -368,7 +368,7 @@ const windowMaximizeCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, maximized) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowMaximizeEvent(window, !!maximized)); } @@ -381,7 +381,7 @@ const bufferSizeCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, width, height) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent(new WindowFramebufferSizeEvent(window, width, height)); } @@ -394,7 +394,7 @@ const keyCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, key, scancode, action, mods) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent( new WindowKeyboardEvent( @@ -423,7 +423,7 @@ const charCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, codepoint) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent( new WindowInputEvent(window, String.fromCodePoint(codepoint)), @@ -438,7 +438,7 @@ const cursorEnterCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, entered) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent( new WindowMouseEvent( @@ -469,7 +469,7 @@ const mouseButtonCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, button, action, mods) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { const x = window._inputState.mouseX; const y = window._inputState.mouseY; @@ -568,7 +568,7 @@ const scrollCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, x, y) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { dispatchEvent( new WindowScrollEvent( @@ -587,7 +587,7 @@ const dropCallback = new Deno.UnsafeCallback( result: "void", } as const, (handle, count, paths) => { - const window = WINDOWS.get(BigInt(Deno.UnsafePointer.value(handle))); + const window = WINDOWS.get(Deno.UnsafePointer.value(handle)); if (window) { const out = []; const view = new Deno.UnsafePointerView(paths!); @@ -687,7 +687,7 @@ export class WindowGlfw extends DwmWindow { throw new Error("Failed to create window"); } - WINDOWS.set(BigInt(Deno.UnsafePointer.value(this.#nativeHandle)), this); + WINDOWS.set(Deno.UnsafePointer.value(this.#nativeHandle), this); glfwSetCursorPosCallback(this.#nativeHandle, cursorPosCallback.pointer); glfwSetWindowPosCallback(this.#nativeHandle, windowPosCallback.pointer); @@ -904,7 +904,7 @@ export class WindowGlfw extends DwmWindow { structview.setInt32(4, hotspot.width, true); structview.setBigInt64( 8, - BigInt(Deno.UnsafePointer.value(stringptr)), + Deno.UnsafePointer.value(stringptr), true, ); @@ -934,7 +934,7 @@ export class WindowGlfw extends DwmWindow { structview.setInt32(4, image.width, true); structview.setBigInt64( 8, - BigInt(Deno.UnsafePointer.value(stringptr)), + Deno.UnsafePointer.value(stringptr), true, ); glfwSetWindowIcon(this.#nativeHandle, 1, structview); @@ -1124,7 +1124,7 @@ export class WindowGlfw extends DwmWindow { this.#closed = true; dispatchEvent(new WindowClosedEvent(this)); glfwDestroyWindow(this.#nativeHandle); - WINDOWS.delete(BigInt(Deno.UnsafePointer.value(this.#nativeHandle))); + WINDOWS.delete(Deno.UnsafePointer.value(this.#nativeHandle)); if (this.#counted) { if (--countedWindows === 0) { glfwTerminate();