From 9d69d8f253b78d9d63ac9dcee4c4901b2949f18c Mon Sep 17 00:00:00 2001 From: demenik Date: Mon, 1 Dec 2025 15:20:31 +0100 Subject: [PATCH] feat: Add keybind for shop (#34) --- src/features/hud/mod.rs | 2 +- src/features/input/mod.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/features/hud/mod.rs b/src/features/hud/mod.rs index 5e0dbdb..875c501 100644 --- a/src/features/hud/mod.rs +++ b/src/features/hud/mod.rs @@ -48,7 +48,7 @@ fn setup(mut commands: Commands) { padding: UiRect::all(px(10)), ..default() }, - |color| text("Shop", 16.0, color) + |color| text("Shop [P]", 16.0, color) ), button( inventory::components::ButtonType::InventoryOpen, diff --git a/src/features/input/mod.rs b/src/features/input/mod.rs index 58f4846..56d80ee 100644 --- a/src/features/input/mod.rs +++ b/src/features/input/mod.rs @@ -1,6 +1,7 @@ use crate::features::{ phase::messages::{NextPhaseMessage, PhaseTimerPauseMessage}, pom::messages::InvalidMoveMessage, + shop::ui::open_shop, }; use crate::prelude::*; use bevy::input::mouse::MouseButton; @@ -28,6 +29,8 @@ impl Plugin for InputPlugin { app.add_message::(); app.add_systems(Update, next_phase.run_if(in_state(AppState::GameScreen))); + + app.add_systems(Update, shop_keybind.run_if(in_state(AppState::GameScreen))); } } @@ -135,3 +138,14 @@ fn next_phase(mut messages: MessageWriter, keys: Res>, + mut commands: Commands, + game_config: Res, + asset_server: Res, +) { + if keys.just_pressed(KeyCode::KeyP) { + open_shop(&mut commands, &game_config, &asset_server); + } +}