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

FlappyBug: Support mouse clicks for flapping

This change allows to play the game using the mouse.
This commit is contained in:
Pedro Pereira 2021-11-23 00:53:52 +00:00 committed by Brian Gianforcaro
parent a099a77e82
commit 913b1fad25
2 changed files with 18 additions and 6 deletions

View file

@ -85,16 +85,26 @@ void Game::keydown_event(GUI::KeyEvent& event)
GUI::Application::the()->quit();
break;
default:
if (ready_to_start()) {
m_active = true;
}
if (m_active) {
m_bug.flap();
}
player_input();
break;
}
}
void Game::mousedown_event(GUI::MouseEvent&)
{
player_input();
}
void Game::player_input()
{
if (ready_to_start()) {
m_active = true;
}
if (m_active) {
m_bug.flap();
}
}
void Game::tick()
{
auto queue_update = [&]() {