(&mut self, ctx: &mut Context)
| 40 | |
| 41 | impl State for GameState { |
| 42 | fn update(&mut self, ctx: &mut Context) -> tetra::Result { |
| 43 | if input::is_key_pressed(ctx, Key::F5) { |
| 44 | *self = GameState::new(ctx)?; |
| 45 | } |
| 46 | |
| 47 | self.resources.input.up = |
| 48 | input::is_key_down(ctx, Key::Up) || input::is_key_down(ctx, Key::W); |
| 49 | self.resources.input.down = |
| 50 | input::is_key_down(ctx, Key::Down) || input::is_key_down(ctx, Key::S); |
| 51 | self.resources.input.left = |
| 52 | input::is_key_down(ctx, Key::Left) || input::is_key_down(ctx, Key::A); |
| 53 | self.resources.input.right = |
| 54 | input::is_key_down(ctx, Key::Right) || input::is_key_down(ctx, Key::D); |
| 55 | |
| 56 | systems::grant_energy(&mut self.world, &mut self.resources); |
| 57 | systems::player_movement(&mut self.world, &mut self.resources); |
| 58 | systems::basic_enemy_movement(&mut self.world, &mut self.resources); |
| 59 | systems::process_movement(&mut self.world, &mut self.resources); |
| 60 | |
| 61 | Ok(()) |
| 62 | } |
| 63 | |
| 64 | fn draw(&mut self, ctx: &mut Context) -> tetra::Result { |
| 65 | graphics::clear(ctx, Color::BLACK); |
nothing calls this directly
no test coverage detected