pagurus
========
[](https://crates.io/crates/pagurus)
[](https://docs.rs/pagurus)
[](https://github.com/sile/pagurus/actions)

🐚+🦞 Ultra-portable Rust game engine suited for offline 2D games powered by WebAssembly.
Examples
--------
### Snake
Traditional snake game: [examples/snake_game](examples/snake_game)
You can play this game on [itch.io](https://reduls.itch.io/snake).
#### How to build and run locally
Build the game:
```console
$ cargo build --release -p snake_game --target wasm32-unknown-unknown
$ ls target/wasm32-unknown-unknown/release/snake_game.wasm
```
Run the game using SDL:
```console
$ cargo run --release -p sdl_runtime -- target/wasm32-unknown-unknown/release/snake_game.wasm
// or
$ cargo run --release -p sdl_snake
```
Run the game on Android:
```console
$ cargo install cargo-apk
$ cargo apk run --lib -p android_snake
```
Run the game on Windows:
```console
$ cargo run --release -p windows_runtime -- target/wasm32-unknown-unknown/release/snake_game.wasm
// or, if you use WSL2 (Ubuntu)
$ sudo apt install gcc-mingw-w64-x86-64
$ rustup target add x86_64-pc-windows-gnu
$ cargo run --target=x86_64-pc-windows-gnu --release -p windows_runtime -- target/wasm32-unknown-unknown/release/snake_game.wasm
```
Run the game on a Web Browser:
```console
$ cd pagurus_web/
$ npm install
$ npm run build
$ npm run example // A HTTP server listening on 8888 port will start
$ open http://localhost:8888/examples/web_snake/
```
Run the game on a terminal (audio is disabled):
```console
$ cargo run --release -p tui_runtime -- target/wasm32-unknown-unknown/release/snake_game.wasm
```
Projects that use Pagurus
-------------------------
- [sile/pixcil](https://github.com/sile/pixcil): Pixel art editor