Skip to main content
Module

x/caviar/deps.ts>DwmWindow

⚡ Blazing fast, modern, Game Engine powered by WebGPU for Deno and the browser
Latest
class DwmWindow
Re-export
Abstract
import { DwmWindow } from "https://deno.land/x/caviar@2.6.7/deps.ts";

Represents a Window

Constructors

new
DwmWindow(_options: CreateWindowOptions)

Properties

abstract
readonly
closed: boolean

Check if the window is closed

abstract
readonly
contentScale: Position

Window's content scale

abstract
focused: boolean

Check if the window is focused

abstract
readonly
framebufferSize: Size

Window's framebuffer size

abstract
readonly
frameSize: LTRB

Frame size

abstract
fullScreen: boolean

Check if the window is fullscreen

id

Window's unique identifier

abstract
maximized: boolean

Change whether the window is maximized

abstract
minimized: boolean

Change whether the window is minimized

abstract
readonly
nativeHandle: Deno.PointerValue

The window's pointer

abstract
opacity: number

Opacity of the window

abstract
position: Position

Window's position

abstract
readonly
shouldClose: boolean

Whether the window should close

abstract
size: Size

Window's size

abstract
title: string

Title of the window

abstract
visible: boolean

Change whether the window is visible

Methods

abstract
close(): void

Close the window

Create a VkSurfaceKHR for this window (Only for Vulkan)

Get the window's input mode

abstract
getMonitor(): DwmMonitor | undefined

Get the monitor that the window is on (undefined if not fullscreen)

abstract
makeContextCurrent(): void

Sets this window's context as the current context (Only for OpenGL)

abstract
rawMouseMotionSupported(): boolean

Check if the window has raw mouse motion

abstract
requestUserAttention(): void

Requests the User's attention

abstract
setAspectRatio(numerator: number, denominator: number): void

Set the window's aspect ratio

abstract
setCursor(icon?: CursorIcon): void

Sets the cursor icon

win.setCursor("hand");
abstract
setCursorPos(xpos: number, ypos: number): void

Sets the cursor to a specific position

abstract
setCustomCursor(
image: Uint8Array,
hotspot: Size,
position: Position,
): void

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): void

Sets 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): void
abstract
setInputMode(mode: InputMode, value: InputModeValue | boolean): void

Set the window's input mode

abstract
setMonitor(
monitor: DwmMonitor | undefined,
xpos?: number,
ypos?: number,
width?: number,
height?: number,
refreshRate?: number,
): void

Set the monitor that the window is on

abstract
setSizeLimits(
minWidth: number,
minHeight: number,
maxWidth: number,
maxHeight: number,
): void

Set the window's size limits

abstract
swapBuffers(): void

Swaps the window's buffers (Only for OpenGL)