Deno SDL2
Cross platform bindings to SDL2. Have fun!
Features
- Bindings to Video, Graphics, Font and Mixer subsystems. (Uses rodio instead of SDL2_Mixer)
- Built on top of Deno's FFI API. Previous versions used TCP streams.
Example
import { Canvas } from "https://deno.land/x/sdl2/src/canvas.ts";
const canvas = new Canvas({ title: "Hello, Deno!", width: 800, height: 400 });
canvas.setDrawColor(0, 64, 255, 255);
canvas.clear();
canvas.present();
for await (const event of canvas) {
switch (event.type) {
case "draw":
// Your game logic
// ...
break;
case "mouse_motion":
// Mouse stuff
break;
case "key_down":
// Keyboard stuff
break;
// ...
default:
break;
}
}
deno_sdl2
Projects using - https://github.com/dhairy-online/dino-deno
- https://github.com/dhairy-online/flappybird
- ...insert your project here
License
MIT