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: "v3.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
To package your application you can use:
See examples.
Usage
Since this module depends on unstable FFI API, you need to pass --unstable
along with --allow-ffi
, --allow-write
and --allow-env
.
deno run --unstable --allow-ffi --allow-write --allow-env <file>
Maintainers
- Dj (@DjDeveloperr)
- Loading (@load1n9)
License
Apache-2.0 licensed.
Copyright 2023 © The Deno Windowing Team