# copper.rs Copper.rs is a simple library for 2D games written in Rust targeting HTML5. # Usage in a webpage To use copper.rs in a webpage, first write your project code using the `copper.rs`-crate make it have `crate-type = ["cdylib", "rlib"]`, make it depend on `wasm-bindgen = "0.2"` and build it using `wasm-pack` for `--target web`. (example for a `lib.rs`) ```rs use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn start() { // code to run on start here } #[wasm_bindgen] pub fn frame() { // code to run on frame here } ``` Then, when built, a directory with a `.wasm`-file and a `.js` (and other files) will be generated. Make this folder accessible to your webpage, as well as `copper.js` (download the file directly from the lastest release [from the repository](https://github.com/devtaube/copper.rs)). (example for your webpage) ```html ```