1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:47:46 +00:00

Breakout: Add possibility to play with A and D

This change will make the player able to control the game with
A and D keys, in addition to the current arrow keys and mouse.
This commit is contained in:
Matheus Vinicius 2021-09-15 02:17:53 -03:00 committed by Brian Gianforcaro
parent 28fabd4728
commit ef3f9b24dd

View file

@ -152,9 +152,11 @@ void Game::keyup_event(GUI::KeyEvent& event)
if (m_paused) if (m_paused)
return; return;
switch (event.key()) { switch (event.key()) {
case Key_A:
case Key_Left: case Key_Left:
m_paddle.moving_left = false; m_paddle.moving_left = false;
break; break;
case Key_D:
case Key_Right: case Key_Right:
m_paddle.moving_right = false; m_paddle.moving_right = false;
break; break;
@ -171,9 +173,11 @@ void Game::keydown_event(GUI::KeyEvent& event)
case Key_Escape: case Key_Escape:
GUI::Application::the()->quit(); GUI::Application::the()->quit();
break; break;
case Key_A:
case Key_Left: case Key_Left:
m_paddle.moving_left = true; m_paddle.moving_left = true;
break; break;
case Key_D:
case Key_Right: case Key_Right:
m_paddle.moving_right = true; m_paddle.moving_right = true;
break; break;