From d5022fdaaf66ef4a976f5ffe77d796b464e172d9 Mon Sep 17 00:00:00 2001 From: Bergmann89 Date: Mon, 21 Dec 2020 21:00:31 +0100 Subject: [PATCH] Renamed 'StateUpdate' to 'InputStateUpdate' --- space-crush-app/src/lib.rs | 5 ++--- .../{state_update.rs => input_state_update.rs} | 12 ++++++------ space-crush-app/src/systems/mod.rs | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) rename space-crush-app/src/systems/{state_update.rs => input_state_update.rs} (92%) diff --git a/space-crush-app/src/lib.rs b/space-crush-app/src/lib.rs index 30aec16..eba0502 100644 --- a/space-crush-app/src/lib.rs +++ b/space-crush-app/src/lib.rs @@ -15,7 +15,7 @@ use debug::{Fleets as DebugFleets, Ships as DebugShips, Summary as DebugSummary} use misc::{Events, TextManager, Window}; use render::{Asteroids, FleetSelect, Init, Planets, Ships}; use resources::{Camera, Config, GameState, Geometry, InputState, Uniform}; -use systems::{FleetControl, StateUpdate}; +use systems::InputStateUpdate; pub struct App<'a, 'b> { is_running: bool, @@ -48,8 +48,7 @@ impl<'a, 'b> App<'a, 'b> { let text_manager = TextManager::new(world)?; let mut dispatcher = DispatcherBuilder::new() - .with(StateUpdate::new(world)?, "state_update", &[]) - .with(FleetControl::new(world)?, "fleet_control", &[]) + .with(InputStateUpdate::new(world)?, "input_state_update", &[]) .with_thread_local(Init::new(world)?) .with_thread_local(Planets::new(world)?) .with_thread_local(Asteroids::new(world)?) diff --git a/space-crush-app/src/systems/state_update.rs b/space-crush-app/src/systems/input_state_update.rs similarity index 92% rename from space-crush-app/src/systems/state_update.rs rename to space-crush-app/src/systems/input_state_update.rs index ae165e5..fee43f0 100644 --- a/space-crush-app/src/systems/state_update.rs +++ b/space-crush-app/src/systems/input_state_update.rs @@ -8,13 +8,13 @@ use crate::{ Error, }; -pub struct StateUpdate { +pub struct InputStateUpdate { mouse_event_id: ReaderId, window_events_id: ReaderId, keyboard_events_id: ReaderId, } -impl StateUpdate { +impl InputStateUpdate { pub fn new(world: &mut World) -> Result { let mouse_event_id = world.register_event_reader::()?; let window_events_id = world.register_event_reader::()?; @@ -29,18 +29,18 @@ impl StateUpdate { } #[derive(SystemData)] -pub struct StateUpdateData<'a> { +pub struct InputStateUpdateData<'a> { input_state: Write<'a, InputState>, mouse_events: ReadExpect<'a, EventChannel>, window_events: ReadExpect<'a, EventChannel>, keyboard_events: ReadExpect<'a, EventChannel>, } -impl<'a> System<'a> for StateUpdate { - type SystemData = StateUpdateData<'a>; +impl<'a> System<'a> for InputStateUpdate { + type SystemData = InputStateUpdateData<'a>; fn run(&mut self, data: Self::SystemData) { - let StateUpdateData { + let InputStateUpdateData { mut input_state, mouse_events, window_events, diff --git a/space-crush-app/src/systems/mod.rs b/space-crush-app/src/systems/mod.rs index 590c3e3..4e959f6 100644 --- a/space-crush-app/src/systems/mod.rs +++ b/space-crush-app/src/systems/mod.rs @@ -1,5 +1,5 @@ mod fleet_control; -mod state_update; +mod input_state_update; pub use fleet_control::FleetControl; -pub use state_update::StateUpdate; +pub use input_state_update::InputStateUpdate;