wasm-game-lib
Welcome!
The goal of this crate is to help you to make great 2d games running in web browsers. This crate is very similar to SFML.
How to use
Please follow these instructions to save yourself a lot of pain. To use this crate, you will need wasm-pack. You can install wasm-pack with:
cargo install wasm-pack
To create your game crate, the best way is to use:
wasm-pack new
Then, put this crate and the wasm-bindgen-futures crate in Cargo.toml as usual. Here is the template you may want to use in lib.rs:
use ;
use Image;
use Sprite;
use Event;
use Window;
use log;
use *;
use sleep;
use Duration;
use set_once;
pub async
You can compile your crate using:
wasm-pack build --target=web
A folder named pkg has been created in the folder of your project. Only two files are important: project_name.js and project_name_bg.wasm.
To use these files on a web page, I recommend you to put the file index.html in the pkg folder, with this content:
Make sure to modify the js file name in index.html depending on your project name. Now, you should be able to run your game by opening index.html in a web browser. In case this does not work, make sure you followed every instruction and contact me.
License: MIT