diff --git a/.gitignore b/.gitignore index eb51052..7e30afa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .direnv/ .devenv/ /target +dist/ diff --git a/Cargo.lock b/Cargo.lock index d7ad078..3c5c769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index e6766d6..4797a6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 + diff --git a/flake.nix b/flake.nix index b735d21..014e3e2 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/index.html b/index.html new file mode 100644 index 0000000..1413785 --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + +
+

Keybinds:

+ +
+ + diff --git a/justfile b/justfile new file mode 100644 index 0000000..748bed7 --- /dev/null +++ b/justfile @@ -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" diff --git a/main.css b/main.css new file mode 100644 index 0000000..cdccf0e --- /dev/null +++ b/main.css @@ -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; +} \ No newline at end of file diff --git a/src/drops.rs b/src/drops.rs index fc919e9..d4ec411 100644 --- a/src/drops.rs +++ b/src/drops.rs @@ -147,8 +147,8 @@ struct CrateCollision { } enum CollisionType { - Player(Entity), - Scene(Entity), + Player, + Scene, } fn crate_collisions( @@ -165,13 +165,13 @@ fn crate_collisions( match collision_event { CollisionEvent::Started(e1, e2, _) if crates.contains(e1) || crates.contains(e2) => { let (coll_type, crate_) = if scene_objs.contains(e1) { - (CollisionType::Scene(*e1), e2) + (CollisionType::Scene, e2) } else if scene_objs.contains(e2) { - (CollisionType::Scene(*e2), e1) + (CollisionType::Scene, e1) } else if *e2 == p { - (CollisionType::Player(*e2), e1) + (CollisionType::Player, e1) } else if *e1 == p { - (CollisionType::Player(*e1), e2) + (CollisionType::Player, e2) } else if crates.contains(e1) && crates.contains(e2) { continue; } else { @@ -192,7 +192,7 @@ fn crate_collisions( fn delete_on_env_coll(mut ev_colls: EventReader, mut commands: Commands) { for CrateCollision { coll_crate, with } in ev_colls.read() { - if let CollisionType::Player(_) = with { + if let CollisionType::Player = with { continue; } @@ -208,7 +208,7 @@ fn player_coll( mut commands: Commands, ) { for CrateCollision { coll_crate, with } in ev_colls.read() { - if let CollisionType::Scene(_) = with { + if let CollisionType::Scene = with { continue; } diff --git a/src/game_over_menu.rs b/src/game_over_menu.rs index 13a9b8c..52f688a 100644 --- a/src/game_over_menu.rs +++ b/src/game_over_menu.rs @@ -1,12 +1,15 @@ -use bevy::{app::AppExit, prelude::*}; +use bevy::prelude::*; -use crate::{game_state::GameTimer, GameState}; +use crate::{game_state::GameTimer, main_menu::button_color_system, GameState}; pub fn game_over_menu_plugin(app: &mut App) { app.add_systems( OnEnter(GameState::GameOver), game_over_menu_setup.in_set(GameOverMenuSet), ) - .add_systems(Update, button_action.in_set(GameOverMenuSet)) + .add_systems( + Update, + (button_action, button_color_system).in_set(GameOverMenuSet), + ) .add_systems(OnExit(GameState::GameOver), exit_menu); } @@ -103,7 +106,6 @@ fn game_over_menu_setup(mut commands: Commands, timer: Query<&GameTimer>) { fn button_action( interaction_query: Query<(&Interaction, &ButtonAction), (Changed, With