CCIMXDesktop
 
Loading...
Searching...
No Matches
EventManager Class Reference

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.
 

Detailed Description

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.

Member Enumeration Documentation

◆ Indication

enum class EventManager::Indication
strong

Enumeration of possible game actions from key presses.

Enumerator
NOTHING 

No action indicated.

JUMP 

Jump action requested.

LAY 

Duck/lay down action requested.

LAUNCH_GAME 

Start game action requested.

◆ KeyReleaseIndication

Enumeration of possible game actions from key releases.

Enumerator
NOTHING 

No action indicated.

RELAX 

Release current action (e.g., stand up from ducking)

Constructor & Destructor Documentation

◆ EventManager() [1/2]

EventManager::EventManager ( )
delete

Deleted default constructor.

EventManager must be constructed with a parent widget reference

◆ EventManager() [2/2]

EventManager::EventManager ( DinasourGameMainWidget h)
inlineexplicit

Constructs an EventManager with a parent widget.

Parameters
hPointer to the main game widget that owns this manager

Member Function Documentation

◆ indication()

Indication EventManager::indication ( ) const
inline

Gets the current action indication from key presses.

Returns
The current Indication value

◆ install_keyPress_keyEvent()

void EventManager::install_keyPress_keyEvent ( QKeyEvent *  keyEvent)

Processes a key press event.

Parameters
keyEventThe Qt key event to process

Translates key presses into game actions and updates the current indication

◆ install_keyRelease_keyEvent()

void EventManager::install_keyRelease_keyEvent ( QKeyEvent *  keyEvent)

Processes a key release event.

Parameters
keyEventThe Qt key event to process

Translates key releases into game actions and updates the release indication

◆ install_mousepress_event()

void EventManager::install_mousepress_event ( QMouseEvent *  mouseEvent)

Processes a mouse press event.

Parameters
mouseEventThe Qt mouse event to process

◆ release_indication()

KeyReleaseIndication EventManager::release_indication ( ) const
inline

Gets the current action indication from key releases.

Returns
The current KeyReleaseIndication value

The documentation for this class was generated from the following files: