Skip to content

Commit

Permalink
feat: rename createWindowSurface to windowSurface
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Jan 24, 2024
1 parent d8f36ec commit 1a2b4ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const window = createWindow({

const { width, height } = window.framebufferSize;

const surface = window.createWindowSurface();
const surface = window.windowSurface();

const context = surface.getContext("webgpu");

Expand Down
16 changes: 2 additions & 14 deletions src/core/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,26 +314,14 @@ export abstract class DwmWindow {
image: ImageStruct,
): void;

/**
* Retrieves the window and display/instance handles required for WebGPU
* ```ts
* const [window, display, instance] = win.rawHandle();
* ```
*/
abstract rawHandle(): [
RawPlatform,
Deno.UnsafePointerView,
Deno.UnsafePointerView | null,
];

/**
* Creates a Window Surface for Use with WebGPU
* ```ts
* const surface = win.createWindowSurface();
* const surface = win.windowSurface();
* const context = surface.getContext("webgpu");
* ```
*/
abstract createWindowSurface(): Deno.UnsafeWindowSurface;
abstract windowSurface(): Deno.UnsafeWindowSurface;
/**
* Check if the window is closed
*/
Expand Down
6 changes: 3 additions & 3 deletions src/platform/glfw/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ export class WindowGlfw extends DwmWindow {
glfwSetCursorPos(this.#nativeHandle, x, y);
}

rawHandle(): [
#rawHandle(): [
RawPlatform,
Deno.UnsafePointerView,
Deno.UnsafePointerView | null,
Expand Down Expand Up @@ -1119,8 +1119,8 @@ export class WindowGlfw extends DwmWindow {
];
}

createWindowSurface() {
const [platform, handle, display] = this.rawHandle();
windowSurface() {
const [platform, handle, display] = this.#rawHandle();
return new Deno.UnsafeWindowSurface(platform, handle, display);
}

Expand Down

0 comments on commit 1a2b4ec

Please sign in to comment.