No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2019-06-05 07:18:36 +02:00
.vscode [example] start with game menu of dungeon example. 2019-01-18 15:54:46 +01:00
crates Start with tilemap widget. 2019-06-05 07:18:36 +02:00
examples OrbTk update. 2019-06-04 13:36:57 +02:00
src Add sub crates api, utils, widgets. 2019-06-05 07:02:32 +02:00
.gitignore [update] initial step of the orbtk next port 2019-01-18 07:54:33 +01:00
.gitlab-ci.yml Restart on OrbTk next. 2018-11-30 23:01:11 +01:00
Cargo.lock Start with tilemap widget. 2019-06-05 07:18:36 +02:00
Cargo.toml Add sub crates api, utils, widgets. 2019-06-05 07:02:32 +02:00
LICENSE Initial commit. 2018-01-08 16:13:01 +01:00
README.md Start with tilemap widget. 2019-06-05 07:18:36 +02:00

OrbGame

OrbTk extensions for 2D game development. Compatible with Redox and SDL2.

Build status MIT licensed

Usage

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.

Minimal Example

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();
}

Additional Examples

You find the examples in the examples/ directory.

You can start the widgets example by executing the following command:

cargo run --example dungeon --release

Additional Examples on Web

To run the examples on a browser you have to install

cargo install -f cargo-web

Run

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

Build and run documentation

You can build and run the latest documentation y executing the following command:

cargo doc --no-deps --open

Sub Crates

  • api: additional game elements
  • utils: Game helper structs and traits
  • widgets: Game widget library

Credits