import { DwmWindow } from "https://deno.land/x/dwm@0.3.5/src/core/mod.ts";
Represents a Window
Properties
abstract
readonly
nativeHandle: Deno.PointerValueThe window's pointer
Methods
abstract
close(): voidClose the window
abstract
createSurface(instance: Deno.PointerValue, allocator?: Deno.PointerValue): Deno.PointerValueCreate a VkSurfaceKHR for this window (Only for Vulkan)
abstract
getInputMode(mode: InputMode): InputModeValueGet the window's input mode
abstract
getMonitor(): DwmMonitor | undefinedGet the monitor that the window is on (undefined if not fullscreen)
abstract
makeContextCurrent(): voidSets this window's context as the current context (Only for OpenGL)
abstract
rawMouseMotionSupported(): booleanCheck if the window has raw mouse motion
abstract
requestUserAttention(): voidRequests the User's attention
abstract
setAspectRatio(numerator: number, denominator: number): voidSet the window's aspect ratio
abstract
setCursor(icon?: CursorIcon): voidSets the cursor icon
win.setCursor("hand");
abstract
setCursorPos(xpos: number, ypos: number): voidSets the cursor to a specific position
abstract
setCustomCursor(image: Uint8Array,
hotspot: Size,
position: Position,
Sets the cursor to a custom image
const cursor = new Uint8Array(16 * 16 * 4);
for (let i = 0; i < 16; i++) {
cursor[i * 16 * 4 + i * 4 + 3] = 255;
cursor[i * 16 * 4 + (15 - i) * 4 + 3] = 255;
}
win.setCustomCursor(cursor, {
width: 16,
height: 16,
}, {
x: 0,
y: 0,
});
abstract
setIcon(image: Uint8Array, sizes: Size): voidSets the window icon to a custom icon
import { decode } from "https://deno.land/x/pngs@0.1.1/mod.ts";
win.setIcon(decode(await Deno.readFile("./path/to/icon/icon.png")));
abstract
setIcon(image: ImageStruct): voidabstract
setInputMode(mode: InputMode, value: InputModeValue | boolean): voidSet the window's input mode
abstract
setMonitor(monitor: DwmMonitor | undefined,
xpos?: number,
ypos?: number,
width?: number,
height?: number,
refreshRate?: number,
Set the monitor that the window is on
abstract
setSizeLimits(minWidth: number,
minHeight: number,
maxWidth: number,
maxHeight: number,
Set the window's size limits
abstract
swapBuffers(): voidSwaps the window's buffers (Only for OpenGL)
abstract
windowSurface(): Deno.UnsafeWindowSurfaceCreates a Window Surface for Use with WebGPU
const surface = win.windowSurface();
const context = surface.getContext("webgpu");