diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cell.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 31 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/cell.rs b/src/cell.rs index 53e9860..6571cd5 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -43,8 +43,9 @@ impl AnimationTimer { } } -#[derive(Debug, PartialEq, Clone, Copy)] +#[derive(Debug, PartialEq, Clone, Copy, Default)] pub enum Occupant { + #[default] None, Green, Yellow, @@ -54,12 +55,6 @@ pub enum Occupant { Explosion, } -impl Default for Occupant { - fn default() -> Occupant { - Occupant::None - } -} - impl Occupant { pub fn to_index(&self) -> usize { match self { diff --git a/src/main.rs b/src/main.rs index b06e30c..136bb87 100644 --- a/src/main.rs +++ b/src/main.rs @@ -177,7 +177,8 @@ fn cosmonaut_detect( cursor_position.x -= (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; + (constants::WINDOW_HEIGHT / 2.0) + constants::TILE_SIZE * constants::TILE_SCALE * 0.5; + cursor_position.y *= -1.0; for (transform, sprite, texture_atlas_handle) in q.iter_mut() { if transform.translation.x < cursor_position.x && transform.translation.x + constants::TILE_SIZE * constants::TILE_SCALE @@ -210,7 +211,8 @@ fn mouse( cursor_position.x -= (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; + (constants::WINDOW_HEIGHT / 2.0) + constants::TILE_SIZE * constants::TILE_SCALE * 0.5; + cursor_position.y *= -1.0; for (cell, _, mut sprite) in q.iter_mut() { if cell.selected { @@ -290,16 +292,19 @@ pub fn main() { ..default() }), ) - .add_startup_system(setup) - .add_systems(( - cell::insert, - cell::falling, - cell::check, - cell::start_explosion, - mouse, - cosmonaut_detect, - animation, - star_spawning, - )) + .add_systems(Startup, setup) + .add_systems( + Update, + ( + cell::insert, + cell::falling, + cell::check, + cell::start_explosion, + mouse, + cosmonaut_detect, + animation, + star_spawning, + ), + ) .run(); } |