Deno Window Manager
Cross-platform window management library for Deno.
Example
import { createWindow, mainloop } from "https://deno.land/x/dwm@0.1.0/mod.ts";
const win = createWindow({
title: "Hello World",
width: 800,
height: 600,
resizable: true,
// To create OpenGL context, set the version:
glVersion: [3, 3],
// By default, no Client API is used.
});
// For OpenGL:
// By default, context is made current when window is created
// You can also make it current manually
win.makeContextCurrent();
// You can also create Vulkan Surface using:
const surfaceKHR = win.createSurface(instancePointer);
// Many DOM events are supported, such as:
addEventListener("resize", (event) => {
console.log("Window resized", event.width, event.height);
});
await mainloop(() => {
// drawing logic ...
// For OpenGL, you have to call this:
win.swapBuffers();
});
For drawing, you can use:
- Deno Gluten
- Skia Canvas (Use
ext/canvas.ts
for an easy to use wrapper) - Deno Vulkan
See examples.
Usage
Since this module depends on unstable FFI API, you need to pass --unstable
along with --allow-ffi
.
deno run --unstable --allow-ffi <file>
Maintainers
- Dj (@DjDeveloperr)
- Loading (@load1n9)
License
Apache-2.0 licensed.
Copyright 2022 © The Deno Windowing Team