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

Starfield: Modify speed by Plus or Minus keypresses

Although this is supposed to be a screensaver, it makes all the sense in
the world that it should support modifying the speed interactively. :^)
This commit is contained in:
Pedro Pereira 2021-11-21 10:46:04 +00:00 committed by Linus Groh
parent 7b923d1376
commit efe5f37b04

View file

@ -85,10 +85,20 @@ void Starfield::mousedown_event(GUI::MouseEvent&)
GUI::Application::the()->quit();
}
void Starfield::keydown_event(GUI::KeyEvent&)
void Starfield::keydown_event(GUI::KeyEvent& event)
{
switch (event.key()) {
case Key_Plus:
m_speed++;
break;
case Key_Minus:
if (--m_speed < 1)
m_speed = 1;
break;
default:
GUI::Application::the()->quit();
}
}
void Starfield::paint_event(GUI::PaintEvent& event)
{