Skip to content

Commit

Permalink
chore: remove unnecessary conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
DjDeveloperr committed Aug 3, 2024
1 parent 517e8be commit d52156c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/platform/glfw/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
);
Expand Down
38 changes: 19 additions & 19 deletions src/platform/glfw/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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();
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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(
Expand Down Expand Up @@ -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)),
Expand All @@ -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(
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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!);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d52156c

Please sign in to comment.