OrbTk extensions for 2D game development. Compatible with Redox and SDL2.
To include orbgame in your project, just add the dependency
line to your Cargo.toml
file:
orbgame = { git = "https://gitlab.redox-os.org/redox-os/orbgame.git" }
However you also need to have the SDL2 libraries installed on your system. The best way to do this is documented by the SDL2 crate.
use orbgame::prelude::*;
fn main() {
Game::new()
.window(|ctx| {
Window::create()
.title("OrbGame - minimal example")
.position((100.0, 100.0))
.size(420.0, 730.0)
.child(TextBlock::create().text("OrbGame").build(ctx))
.build(ctx)
})
.run();
}
You find the examples in the examples/
directory.
You can start the widgets example by executing the following command:
cargo run --example dungeon --release
To run the examples on a browser you have to install
cargo install -f cargo-web
You can start the dungeon example by executing the following command:
- Compile to WebAssembly using Rust's native WebAssembly backend:
cargo web start --target=wasm32-unknown-unknown --auto-reload --example dungeon
- Compile to asm.js using Emscripten:
$ cargo web start --target=asmjs-unknown-emscripten --auto-reload --example dungeon
- Compile to WebAssembly using Emscripten:
$ cargo web start --target=wasm32-unknown-emscripten --auto-reload --example dungeon
You can build and run the latest documentation y executing the following command:
cargo doc --no-deps --open
- api: additional game elements
- utils: Game helper structs and traits
- widgets: Game widget library