Skip to main content
Deno 2 is finally here 🎉️
Learn more

Deno Window Manager

Tags Doc Checks License Sponsor

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:

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

License

Apache-2.0 licensed.

Copyright 2022 © The Deno Windowing Team