This commit is contained in:
Pascal Engélibert 2023-08-02 08:35:09 +02:00
parent c203be7b2a
commit 7e2bdd5203
5 changed files with 1404 additions and 970 deletions

2340
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,21 +6,21 @@ license = "AGPL-3.0-only"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
bevy = { version = "0.8.1", default-features = false, features = ["bevy_asset", "bevy_audio", "bevy_gilrs", "bevy_winit", "render", "png", "vorbis", "x11"] } bevy = { version = "0.11.0", default-features = false, features = ["bevy_asset", "bevy_audio", "bevy_gilrs", "bevy_winit", "png", "vorbis", "x11"] }
bevy_common_assets = { version = "0.3.0", features = ["json"] } bevy_common_assets = { version = "0.7.0", features = ["json"] }
bevy_rapier2d = "0.16.2" bevy_rapier2d = "0.22.0"
#crossbeam-channel = "0.5.6" #crossbeam-channel = "0.5.6"
rand = "0.8.5" rand = "0.8.5"
rand_distr = "0.4.3" rand_distr = "0.4.3"
rapier2d = "0.14.0" rapier2d = "0.17.2"
serde = { version = "1.0.144", features = ["derive"] } serde = { version = "1.0.180", features = ["derive"] }
[target."cfg(not(target_arch = \"wasm32\"))".dependencies] [target."cfg(not(target_arch = \"wasm32\"))".dependencies]
#bevy-inspector-egui = "0.12.1" #bevy-inspector-egui = "0.12.1"
bevy_mod_picking = "0.9.0" bevy_mod_picking = "0.14.0"
# cpal = "0.14.0" # cpal = "0.14.0"
# hexodsp = { git = "https://github.com/WeirdConstructor/HexoDSP", default-features = false } # hexodsp = { git = "https://github.com/WeirdConstructor/HexoDSP", default-features = false }
serde_json = "1.0.85" serde_json = "1.0.104"
#ticktock = "0.8.0" #ticktock = "0.8.0"
[target."cfg(target_arch = \"wasm32\")".dependencies] [target."cfg(target_arch = \"wasm32\")".dependencies]
@ -30,4 +30,5 @@ serde_json = "1.0.85"
opt-level = 3 opt-level = 3
[patch.crates-io] [patch.crates-io]
wgpu = { git = "https://github.com/mockersf/wgpu/", branch = "unconditional-clear-workaround" } #wgpu = { git = "https://github.com/mockersf/wgpu/", branch = "unconditional-clear-workaround" }
bevy_mod_picking = { git = "https://github.com/bardt/bevy_mod_picking/", branch = "bevy_0.11" }

View file

@ -35,7 +35,6 @@ impl PassThroughFilter {
#[derive(Bundle)] #[derive(Bundle)]
pub struct AbsorbingFilter { pub struct AbsorbingFilter {
#[bundle]
pub mesh: ColorMesh2dBundle, pub mesh: ColorMesh2dBundle,
pub collider: Collider, pub collider: Collider,
pub sensor: Sensor, pub sensor: Sensor,
@ -70,7 +69,6 @@ pub fn spawn_absorbing_filter(
#[derive(Bundle)] #[derive(Bundle)]
pub struct RotatingFilter { pub struct RotatingFilter {
#[bundle]
pub sprite: SpriteBundle, pub sprite: SpriteBundle,
pub collider: Collider, pub collider: Collider,
pub sensor: Sensor, pub sensor: Sensor,

View file

@ -64,9 +64,10 @@ impl Plugin for GamePlugin {
} }
// Events // Events
#[derive(Event)]
pub struct LevelStartupEvent; pub struct LevelStartupEvent;
#[derive(Event)]
pub struct ChangeCharacterEvent; pub struct ChangeCharacterEvent;
// Resources // Resources

View file

@ -18,8 +18,9 @@ use bevy::{
use bevy_common_assets::json::JsonAssetPlugin; use bevy_common_assets::json::JsonAssetPlugin;
use bevy_rapier2d::prelude::*; use bevy_rapier2d::prelude::*;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq, States)]
enum AppState { enum AppState {
#[default]
Loading, Loading,
Menu, Menu,
Game, Game,
@ -51,10 +52,9 @@ fn main() {
let (first_level, use_editor) = (game::LevelId(0), false); let (first_level, use_editor) = (game::LevelId(0), false);
let mut app = App::new(); let mut app = App::new();
app.insert_resource(Msaa { samples: 4 }) app.insert_resource(Default::default())
.insert_resource(WindowDescriptor { .insert_resource(Window {
width: 640.0, resolution: (640., 480.).into(),
height: 480.0,
resize_constraints: WindowResizeConstraints { resize_constraints: WindowResizeConstraints {
min_width: 256., min_width: 256.,
min_height: 256., min_height: 256.,
@ -66,7 +66,7 @@ fn main() {
..Default::default() ..Default::default()
}) })
.insert_resource(UseEditor(use_editor)) .insert_resource(UseEditor(use_editor))
.add_state(AppState::Loading) .add_state::<AppState>()
.insert_resource(game::FirstLevel(first_level)) .insert_resource(game::FirstLevel(first_level))
.insert_resource(ClearColor(Color::BLACK)) .insert_resource(ClearColor(Color::BLACK))
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)