Handles and processes user input events for the game. More...
#include <EventManager.h>
Public Types | |
enum class | Indication { NOTHING , JUMP , LAY , LAUNCH_GAME } |
Enumeration of possible game actions from key presses. More... | |
enum class | KeyReleaseIndication { NOTHING , RELAX } |
Enumeration of possible game actions from key releases. More... | |
Public Member Functions | |
EventManager ()=delete | |
Deleted default constructor. | |
EventManager (DinasourGameMainWidget *h) | |
Constructs an EventManager with a parent widget. | |
void | install_keyPress_keyEvent (QKeyEvent *keyEvent) |
Processes a key press event. | |
void | install_keyRelease_keyEvent (QKeyEvent *keyEvent) |
Processes a key release event. | |
void | install_mousepress_event (QMouseEvent *mouseEvent) |
Processes a mouse press event. | |
Indication | indication () const |
Gets the current action indication from key presses. | |
KeyReleaseIndication | release_indication () const |
Gets the current action indication from key releases. | |
Handles and processes user input events for the game.
The EventManager class processes keyboard and mouse events, translating them into game actions and indications. It acts as an intermediary between Qt's input system and the game logic.
|
strong |
|
strong |
|
delete |
Deleted default constructor.
EventManager must be constructed with a parent widget reference
|
inlineexplicit |
Constructs an EventManager with a parent widget.
h | Pointer to the main game widget that owns this manager |
|
inline |
Gets the current action indication from key presses.
void EventManager::install_keyPress_keyEvent | ( | QKeyEvent * | keyEvent | ) |
Processes a key press event.
keyEvent | The Qt key event to process |
Translates key presses into game actions and updates the current indication
void EventManager::install_keyRelease_keyEvent | ( | QKeyEvent * | keyEvent | ) |
Processes a key release event.
keyEvent | The Qt key event to process |
Translates key releases into game actions and updates the release indication
void EventManager::install_mousepress_event | ( | QMouseEvent * | mouseEvent | ) |
Processes a mouse press event.
mouseEvent | The Qt mouse event to process |
|
inline |
Gets the current action indication from key releases.