diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs index 624aa5b..79c0f2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,14 +118,14 @@ pub fn setup( fn animation_system( commands: &mut Commands, time: Res<Time>, - mut cell_query: Query<( + mut q: Query<( Entity, Option<&mut Cell>, &mut Timer, &mut TextureAtlasSprite, )>, ) { - for (entity, cell, mut timer, mut sprite) in cell_query.iter_mut() { + for (entity, cell, mut timer, mut sprite) in q.iter_mut() { timer.tick(time.delta_seconds()); if timer.finished() { let index = match sprite.index { @@ -160,7 +160,7 @@ fn animation_system( fn cosmonaut_detect_system( commands: &mut Commands, windows: Res<Windows>, - mut cell_query: Query<(&Transform, &TextureAtlasSprite)>, + mut q: Query<(&Transform, &TextureAtlasSprite)>, ) { if let Some(mut cursor_position) = windows .get_primary() @@ -170,7 +170,7 @@ fn cosmonaut_detect_system( (constants::WINDOW_WIDTH / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5; cursor_position.y -= (constants::WINDOW_HEIGHT / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5; - for (transform, sprite) in cell_query.iter_mut() { + for (transform, sprite) in q.iter_mut() { if transform.translation.x < cursor_position.x && transform.translation.x + constants::TILE_SIZE * constants::TILE_SCALE > cursor_position.x @@ -193,7 +193,7 @@ fn cosmonaut_detect_system( fn mouse_system( windows: Res<Windows>, - mut cell_query: Query<(&mut Cell, &mut Transform, &mut TextureAtlasSprite)>, + mut q: Query<(&mut Cell, &mut Transform, &mut TextureAtlasSprite)>, mouse_button_input: Res<Input<MouseButton>>, ) { if let Some(mut cursor_position) = windows @@ -205,7 +205,7 @@ fn mouse_system( cursor_position.y -= (constants::WINDOW_HEIGHT / 2.0) - constants::TILE_SIZE * constants::TILE_SCALE * 0.5; - for (cell, _, mut sprite) in cell_query.iter_mut() { + for (cell, _, mut sprite) in q.iter_mut() { if cell.selected { sprite.color.set_a(0.2); } else if cell.hovered { @@ -215,7 +215,7 @@ fn mouse_system( } } - for (mut cell, transform, _) in cell_query.iter_mut() { + for (mut cell, transform, _) in q.iter_mut() { if transform.translation.x < cursor_position.x && transform.translation.x + constants::TILE_SIZE * constants::TILE_SCALE > cursor_position.x @@ -234,7 +234,7 @@ fn mouse_system( if mouse_button_input.just_released(MouseButton::Left) { let mut cells: Vec<Cell> = Vec::new(); - for (cell, _, _) in cell_query.iter_mut() { + for (cell, _, _) in q.iter_mut() { cells.push(*cell); } if let Some(mut selected) = cells.clone().iter_mut().find(|c| c.selected) { @@ -247,7 +247,7 @@ fn mouse_system( let tmp = selected.occupant; selected.occupant = hovered.occupant; hovered.occupant = tmp; - for (mut cell, _, mut sprite) in cell_query.iter_mut() { + for (mut cell, _, mut sprite) in q.iter_mut() { if cell.x == selected.x && cell.y == selected.y { cell.occupant = selected.occupant; sprite.index = cell.occupant.to_index(); @@ -259,7 +259,7 @@ fn mouse_system( } } } - for (mut cell, _, _) in cell_query.iter_mut() { + for (mut cell, _, _) in q.iter_mut() { cell.selected = false; } } |