From fe2ade13e96005b9d02b8542bb02a1ea1314b4f3 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Fri, 24 Dec 2021 18:44:24 +0100 Subject: [PATCH] Pong: Support W and S keys for movement --- Userland/Games/Pong/Game.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Games/Pong/Game.cpp b/Userland/Games/Pong/Game.cpp index 53aad289cb..bfb13207d5 100644 --- a/Userland/Games/Pong/Game.cpp +++ b/Userland/Games/Pong/Game.cpp @@ -72,10 +72,12 @@ void Game::paint_event(GUI::PaintEvent& event) void Game::keyup_event(GUI::KeyEvent& event) { switch (event.key()) { + case Key_W: case Key_Up: m_up_key_held = false; m_player1_paddle.moving_up = false; break; + case Key_S: case Key_Down: m_down_key_held = false; m_player1_paddle.moving_down = false; @@ -91,12 +93,14 @@ void Game::keydown_event(GUI::KeyEvent& event) case Key_Escape: GUI::Application::the()->quit(); break; + case Key_W: case Key_Up: m_up_key_held = true; m_player1_paddle.moving_up = true; m_player1_paddle.moving_down = false; m_cursor_paddle_target_y.clear(); break; + case Key_S: case Key_Down: m_down_key_held = true; m_player1_paddle.moving_up = false;