CCIMXDesktop
 
Loading...
Searching...
No Matches
EventManager.h
1#ifndef EVENTMANAGER_H
2#define EVENTMANAGER_H
3
4class QKeyEvent;
5class QMouseEvent;
7
17public:
21 enum class Indication {
22 NOTHING,
23 JUMP,
24 LAY,
26 };
27
32 NOTHING,
33 RELAX
34 };
35
41 EventManager() = delete;
42
48 holdings = h;
49 }
50
57 void install_keyPress_keyEvent(QKeyEvent* keyEvent);
58
65 void install_keyRelease_keyEvent(QKeyEvent* keyEvent);
66
71 void install_mousepress_event(QMouseEvent* mouseEvent);
72
77 inline Indication indication() const { return ind; }
78
83 inline KeyReleaseIndication release_indication() const { return release_ind; }
84
85private:
86 DinasourGameMainWidget* holdings;
87 Indication ind;
88 KeyReleaseIndication release_ind;
89};
90
91#endif // EVENTMANAGER_H
Main game widget that manages the dinosaur game.
Definition DinasourGameMainWidget.h:23
Handles and processes user input events for the game.
Definition EventManager.h:16
Indication indication() const
Gets the current action indication from key presses.
Definition EventManager.h:77
Indication
Enumeration of possible game actions from key presses.
Definition EventManager.h:21
@ LAY
Duck/lay down action requested.
@ JUMP
Jump action requested.
@ LAUNCH_GAME
Start game action requested.
@ NOTHING
No action indicated.
KeyReleaseIndication
Enumeration of possible game actions from key releases.
Definition EventManager.h:31
@ RELAX
Release current action (e.g., stand up from ducking)
void install_keyPress_keyEvent(QKeyEvent *keyEvent)
Processes a key press event.
Definition EventManager.cpp:6
void install_keyRelease_keyEvent(QKeyEvent *keyEvent)
Processes a key release event.
Definition EventManager.cpp:33
EventManager(DinasourGameMainWidget *h)
Constructs an EventManager with a parent widget.
Definition EventManager.h:47
EventManager()=delete
Deleted default constructor.
void install_mousepress_event(QMouseEvent *mouseEvent)
Processes a mouse press event.
Definition EventManager.cpp:40
KeyReleaseIndication release_indication() const
Gets the current action indication from key releases.
Definition EventManager.h:83