Skip to content

Commit

Permalink
Final version
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolandu committed Feb 7, 2024
1 parent 06eb337 commit 060c4a1
Show file tree
Hide file tree
Showing 8 changed files with 493 additions and 433 deletions.
10 changes: 0 additions & 10 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = {version = "0.12.1", features = ["dynamic_linking"]}
bevy = "0.12.1"
bevy_rapier2d = "0.23.0"

[profile.dev]
Expand All @@ -15,3 +15,8 @@ opt-level = 1
[profile.dev.package."*"]
opt-level = 3
codegen-units = 1

[profile.release]
opt-level = 'z'
codegen-units = 1
lto = true
13 changes: 13 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

cd "$parent_path"
cargo build --release
rm -r ./out/
wasm-bindgen --no-typescript --target web \
--out-dir ./out/ \
--out-name "bounce_simulator" \
./target/wasm32-unknown-unknown/release/bounce_simulator.wasm
wasm-opt -Oz -o ./out/bounce_simulator_bg.wasm ./out/bounce_simulator_bg.wasm
cp -a ./assets/ ./out/
cp index.html ./out/
33 changes: 33 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">

<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />

<head>
<style>
body {
margin: 0px;
display: flex;
overflow: hidden;
height: 100vh;
}

canvas {
touch-action: none;
}
</style>
</head>

<body>
<script type="module">
import init from './bounce_simulator.js'

init().catch((error) => {
if (!error.message.startsWith("Using exceptions for control flow, don't mind me. This isn't actually an error!")) {
throw error;
}
});
</script>
</body>

</html>
Loading

0 comments on commit 060c4a1

Please sign in to comment.