aboutsummaryrefslogtreecommitdiff
path: root/pixel-client/src/menu/ingame.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-09-29 23:56:14 +0200
committermetamuffin <metamuffin@disroot.org>2025-09-30 01:19:09 +0200
commit727752b87bbe7146adb0f9e9e27d6e64b785ec2f (patch)
treeec51a98bb0f3334e66690484db497709d9d48eb4 /pixel-client/src/menu/ingame.rs
parentbd52f4617d04d9b3cda279d48fc75d5a067101fe (diff)
downloadhurrycurry-727752b87bbe7146adb0f9e9e27d6e64b785ec2f.tar
hurrycurry-727752b87bbe7146adb0f9e9e27d6e64b785ec2f.tar.bz2
hurrycurry-727752b87bbe7146adb0f9e9e27d6e64b785ec2f.tar.zst
Remove pixel client
Diffstat (limited to 'pixel-client/src/menu/ingame.rs')
-rw-r--r--pixel-client/src/menu/ingame.rs78
1 files changed, 0 insertions, 78 deletions
diff --git a/pixel-client/src/menu/ingame.rs b/pixel-client/src/menu/ingame.rs
deleted file mode 100644
index 66c77bce..00000000
--- a/pixel-client/src/menu/ingame.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-use super::main::MainMenu;
-use crate::{
- config::Config,
- game::Game,
- render::{sprite::SpriteDraw, AtlasLayout, Renderer},
- strings::tr,
- ui::UiState,
- State,
-};
-use hurrycurry_protocol::glam::Vec2;
-use sdl2::{
- keyboard::{KeyboardState, Keycode},
- mouse::MouseState,
-};
-
-pub struct IngameMenu {
- game: Box<Game>,
- pub ui_state: UiState,
- overlay_shown: bool,
- next_state: Option<Box<State>>,
-}
-impl IngameMenu {
- pub fn new(game: Game) -> Self {
- Self {
- overlay_shown: false,
- game: Box::new(game),
- ui_state: UiState::default(),
- next_state: None,
- }
- }
- pub fn tick(
- &mut self,
- dt: f32,
- keyboard: &KeyboardState,
- mouse: &MouseState,
- layout: &AtlasLayout,
- ) -> Option<Box<State>> {
- self.game.tick(dt, keyboard, layout);
- self.ui_state.update(keyboard, mouse, dt);
- self.next_state.take()
- }
- pub fn keyboard_event(&mut self, keycode: Keycode, down: bool) {
- self.ui_state.keyboard_event(keycode, down);
- if down && keycode == Keycode::Escape {
- self.overlay_shown = !self.overlay_shown
- }
- }
- pub fn draw(&mut self, ctx: &mut Renderer, _config: &mut Config) {
- self.game.draw(ctx);
- if self.overlay_shown {
- let mut main_menu = false;
- ctx.draw_ui(SpriteDraw::overlay(
- ctx.misc_textures.solid,
- Vec2::ZERO,
- ctx.ui_size,
- Some([0, 0, 0, 130]),
- ));
- self.ui_state.draw(ctx, |ui| {
- ui.horizontal(|ui| {
- ui.advance(Vec2::splat(20.));
- ui.vertical(|ui| {
- ui.advance(Vec2::splat(20.));
- let w = 80.;
- main_menu |= ui.button(w, tr("c.menu.ingame.resume"));
- ui.advance(Vec2::Y * 10.);
- main_menu |= ui.button(w, tr("c.menu.ingame.main_menu"));
- if ui.button(w, tr("c.menu.ingame.quit")) {
- self.next_state = Some(Box::new(State::Quit))
- }
- });
- });
- });
- if main_menu {
- self.next_state = Some(Box::new(State::MainMenu(MainMenu::new(ctx.atlas_layout()))))
- }
- }
- }
-}