Skip to content

Commit

Permalink
Make macroquad the default
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-t committed Jun 7, 2021
1 parent ab28bca commit 459c6a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ wasm-opt = ["-O3", "--enable-mutable-globals"] # see wasm-opt note

[features]
# The macroquad dependency must *not* be present when compiling to WASM+canvas,
# otherwise it will crash with a TypeError at runtime for some reason.
# LATER Make mq default so `cargo run` just works?
# otherwise it will crash with a TypeError at runtime for some reason,
# explicitly use `--no-default-features` to disable it when compiling WASM+canvas.
default = ["mq"]
mq = ["macroquad", "image"]
raw_canvas = ["console_error_panic_hook", "js-sys", "wasm-bindgen", "web-sys"]

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ Compiling and running
### Native version (macroquad)

How to run:
- `cargo run --features mq`
- `cargo run`

### Browser version (macroquad + WASM)

Might have [performance issues](https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0) in firefox on linux - making the window smaller might help.

How to run locally:

- `cargo build --bin rec-wars-macroquad --features mq --target wasm32-unknown-unknown && mv target/wasm32-unknown-unknown/debug/rec-wars-macroquad.wasm rec-wars-macroquad.wasm`
- `cargo build --bin rec-wars-macroquad --target wasm32-unknown-unknown && mv target/wasm32-unknown-unknown/debug/rec-wars-macroquad.wasm rec-wars-macroquad.wasm`
- host with `python3 -m http.server` (or any other web server, simply opening `macroquad.html` will *not* work though)
- open http://localhost:8000/macroquad.html

Expand All @@ -81,7 +81,7 @@ This version is hosted [here](https://martin-t.gitlab.io/gitlab-pages/rec-wars/w
Might have [performance issues](https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0) in firefox on linux - making the canvas element smaller might help.

How to run locally:
- build with `wasm-pack build --target web --dev -- --features raw_canvas`
- build with `wasm-pack build --target web --dev -- --no-default-features --features raw_canvas`
- you can replace `--dev` with `--profiling` or `--release` if perf is an issue (see [Cargo.toml](Cargo.toml) for more info)
- host with `python3 -m http.server` (or any other web server, simply opening `index.html` will *not* work though)
- open http://localhost:8000/web/
Expand Down

0 comments on commit 459c6a4

Please sign in to comment.