mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
BrickGame: Add a "Pause" option to the Game menu
This is how the menu looks like after this commit: ┌────┐ │Game│ Help ├────┴─────────────────────────────┐ │ New game F2 │ │ Toggle pause P │ ├──────────────────────────────────┤ │ Quit Alt+F4 │ └──────────────────────────────────┘
This commit is contained in:
parent
a337557658
commit
ddac8192e3
3 changed files with 11 additions and 2 deletions
|
@ -446,6 +446,12 @@ void BrickGame::reset()
|
|||
update();
|
||||
}
|
||||
|
||||
void BrickGame::toggle_pause()
|
||||
{
|
||||
m_brick_game->toggle_pause();
|
||||
update();
|
||||
}
|
||||
|
||||
void BrickGame::timer_event(Core::TimerEvent&)
|
||||
{
|
||||
switch (m_brick_game->state()) {
|
||||
|
@ -466,8 +472,7 @@ void BrickGame::keydown_event(GUI::KeyEvent& event)
|
|||
switch (event.key()) {
|
||||
case KeyCode::Key_Escape:
|
||||
case KeyCode::Key_P:
|
||||
m_brick_game->toggle_pause();
|
||||
update();
|
||||
toggle_pause();
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue