Skip to content

Commit

Permalink
✨ web build
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienjuif committed Nov 10, 2023
1 parent bf5ae02 commit 06f5005
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ release-windows:

release-mac-m1:
@cross build --target=aarch64-apple-darwin --release

release-wasm:
@cargo build --release --target wasm32-unknown-unknown
@wasm-bindgen --out-name wasm_game --out-dir target/web/release --target web target/wasm32-unknown-unknown/release/game.wasm
@cp web/* target/web/release/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ rustup target add x86_64-pc-windows-msvc
```

- `make release-windows`

### Wasm

https://github.com/bevyengine/bevy/tree/main/examples#setup-2
27 changes: 27 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<html>
<head>
<meta charset="UTF-8" />
<style>
body {
background: linear-gradient(
135deg,
white 0%,
white 49%,
black 49%,
black 51%,
white 51%,
white 100%
);
background-repeat: repeat;
background-size: 20px 20px;
}
canvas {
background-color: white;
}
</style>
</head>
<script type="module">
import init from './wasm_game.js'
init()
</script>
</html>

0 comments on commit 06f5005

Please sign in to comment.