mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:47:46 +00:00
Pong: Improve mouse controls
Just because you're the player, doesn't mean you can cheat ;) - Limit paddle speed when following mouse cursor. - Unhide pointer -- can't grab it, can't see when it's about to leave the window otherwise. - Add last pointer y position indication for the player paddle. - Prevent the paddle from following the mouse when Up or Down is being held (avoid controls fighting).
This commit is contained in:
parent
bb76bcde57
commit
58131082f4
2 changed files with 44 additions and 5 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
|
@ -97,6 +98,10 @@ private:
|
|||
int m_score_to_win = 21;
|
||||
int m_player_1_score = 0;
|
||||
int m_player_2_score = 0;
|
||||
|
||||
Optional<int> m_cursor_paddle_target_y;
|
||||
bool m_up_key_held = false;
|
||||
bool m_down_key_held = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue