MCPcopy Index your code
hub / github.com/DjDeveloperr/deno_desktop

github.com/DjDeveloperr/deno_desktop @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
503 symbols 877 edges 15 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

deno_desktop

Windowing support for Deno WebGPU. In very early stages at the moment.

demo

Usage

const win = Deno.createWindow({
  title: "Deno Desktop",
  width: 800,
  height: 600,
  resizable: false,
  // ...
});

const surface = win.createSurface(device);

The surface object maps to the WebGPU GPUCanvasContext object. So you first configure it then render to the texture returned for each frame by getCurrentTexture. Do note that unlike web implementations, you need to call surface.present() after rendering it.

You also need to go through the event loop in order to render. Deno.eventLoop() returns Async Iterator yielding events. Mostly you'd do something like this:

for await (const event of Deno.eventLoop()) {
  if (event.type === "windowEvent" && event.windowID === win.id) {
    if (event.event.type === "closeRequested") {
      // Do any cleanup stuff before this.
      // There is an unverified bug that causes panic if we do not 
      // exit manually.
      Deno.exit(0);
    }
  } else if (event.type === "redrawRequested" && event.windowID === win.id) {
    // Render things and then present them on Window.
    renderStuff();
    surface.present();
  }
}

And finally, in order to receive redrawRequested events, call win.requestRedraw in your program's main loop.

TODO

  • Try to match Web API. Such as not having to call present.
  • Complete the winit bindings.

Notes

  • I'm currently using a fork of Deno in this. It is to export some private structs in order to extend WebGPU API. Also, the fork uses an updated version of wgpu as of now.
  • Debug builds seem to be locked at 30 fps usually, while release builds are 60 fps in same test.

License

Check LICENSE for more info.

Copyright 2021 @ DjDeveloperr

Core symbols most depended-on inside this repo

from
called by 33
examples/extern/gmath.bundle.js
mul
called by 32
examples/extern/gmath.bundle.js
sub
called by 26
examples/extern/gmath.bundle.js
get_window
called by 25
src/window.rs
add
called by 22
examples/extern/gmath.bundle.js
normal
called by 15
examples/extern/gmath.bundle.js
cross
called by 13
examples/extern/gmath.bundle.js
zero
called by 12
examples/extern/gmath.bundle.js

Shape

Method 359
Function 91
Class 53

Languages

TypeScript86%
Rust14%

Modules by API surface

examples/extern/gmath.bundle.js328 symbols
src/core.js44 symbols
src/window.rs37 symbols
examples/extern/pngs.bundle.js24 symbols
examples/hello_camera.js16 symbols
src/surface.rs13 symbols
examples/common.js11 symbols
src/event_loop.rs8 symbols
src/extra.rs6 symbols
examples/hello_triangle.js5 symbols
examples/hello_texture.js5 symbols
src/runtime.rs2 symbols

For agents

$ claude mcp add deno_desktop \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact