Windows build

This commit is contained in:
2026-11-22 19:49:50 -03:00
parent ed6f5fe0df
commit cbd662dc2a
12 changed files with 625 additions and 16 deletions
+3 -3
View File
@@ -5,8 +5,9 @@
// the client's messages (see client/native/messages.ts), keys named like the dom's. sdl's relative mouse mode grabs
// the mouse, which unlike a browser's pointer lock never gets taken away by escape or held back after letting go
import type { SurfaceHandles, WindowMessage } from "../client/native/messages.ts";
import { type LibraryFiles, open_library } from "./libraries.ts";
const LIBRARY = { linux: "libSDL3.so.0", windows: "SDL3.dll", darwin: "libSDL3.0.dylib" }[Deno.build.os as string];
const LIBRARY: LibraryFiles = { linux: "libSDL3.so.0", windows: "SDL3.dll", darwin: "libSDL3.0.dylib" };
const SYMBOLS = {
SDL_Init: { parameters: ["u32"], result: "bool" },
@@ -142,8 +143,7 @@ export class SdlWindow {
// throws when there's no sdl3 or no window can be made
constructor(title: string, width: number, height: number) {
if (!LIBRARY) throw new Error(`There's no sdl3 for ${Deno.build.os}`);
this.#sdl = Deno.dlopen(LIBRARY, SYMBOLS).symbols;
this.#sdl = open_library("sdl3", LIBRARY, SYMBOLS);
if (!this.#sdl.SDL_Init(INIT_VIDEO)) throw new Error(`Couldn't start sdl: ${this.#error()}`);
// not high pixel density: frames are drawn at the window's size and the os scales them, like a page's canvas
const window = this.#sdl.SDL_CreateWindow(c_string(title), width, height, WINDOW_RESIZABLE);