docs.rs failed to build deno_sdl2-0.3.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
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!",
height: 800,
width: 600,
centered: true,
fullscreen: false,
hidden: false,
resizable: true,
minimized: false,
maximized: false,
flags: null,
});
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;
}
}
Building from source
You need:
deno_bindgen
CLI from themain
branch- Rust nightly toolchain + Cargo (
1.57.0-nightly
) cargo-vcpkg
toolpkg-config
(on *nix) =>brew install pkg-config
# build vcpkg dependencies
Build using:
Projects using deno_sdl2
-
...insert your project here
License
MIT