setup wasm

This commit is contained in:
Schrottkatze 2024-05-12 12:03:50 +02:00
parent 7de16e410e
commit 7be75ce106
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
7 changed files with 57 additions and 11 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.direnv/
.devenv/
/target
dist/

10
Cargo.lock generated
View file

@ -293,7 +293,6 @@ version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65b9eadaacf8fe971331bc3f250f35c18bc9dace3f96b483062f38ac07e3a1b4"
dependencies = [
"bevy_dylib",
"bevy_internal",
]
@ -470,15 +469,6 @@ dependencies = [
"sysinfo",
]
[[package]]
name = "bevy_dylib"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922826e3b8f37c19836b49e18ceca662260cce87ab8faa4db6df8433903660cc"
dependencies = [
"bevy_internal",
]
[[package]]
name = "bevy_ecs"
version = "0.13.2"

View file

@ -4,7 +4,8 @@ version = "0.1.0"
edition = "2021"
[dependencies]
bevy = {version = "0.13.2", features = ["dynamic_linking"]}
# bevy = {version = "0.13.2", features = ["dynamic_linking"]}
bevy = "0.13.2"
bevy_rand = { version = "0.6.0", features = ["wyrand"] }
bevy_rapier2d = "0.26.0"
rand = "0.8.5"
@ -18,3 +19,7 @@ opt-level = 3
[profile.dev.package.bevy_rapier2d]
opt-level = 3
[profile.release]
lto = true

View file

@ -31,6 +31,7 @@
rs-toolchain = with fenix.packages.${system};
combine [
complete.toolchain
targets.wasm32-unknown-unknown.latest.rust-std
# rust-analyzer
];
my-crate = craneLib.buildPackage {
@ -71,6 +72,8 @@
wayland
mold-wrapped
clang
trunk
binaryen
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;

15
index.html Normal file
View file

@ -0,0 +1,15 @@
<html>
<head>
<link data-trunk rel="css" href="main.css"/>
</head>
<body>
<section>
<h1>Keybinds:</h1>
<ul>
<li>W: Jump</li>
<li>A: Walk left</li>
<li>D: Walk right</li>
</ul>
</section>
</body>
</html>

5
justfile Normal file
View file

@ -0,0 +1,5 @@
deploy-katzencafe: build-wasm
rsync dist/* root@katzen.cafe:/var/www/miau/evader
build-wasm:
trunk build --release --public-url "/evader"

27
main.css Normal file
View file

@ -0,0 +1,27 @@
html,
body {
margin: 0;
padding: 0;
background-color: #222;
}
body {
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column-reverse;
justify-content: center;
align-items: center;
}
canvas:focus {
border: none;
outline: none;
}
h1,
li,
ul {
font-family: sans-serif;
color: white;
}