R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
InputEvent Class Reference

Event representing a player input action. More...

#include <InputEvent.hpp>

Inheritance diagram for InputEvent:
Inheritance graph
Collaboration diagram for InputEvent:
Collaboration graph

Public Member Functions

 InputEvent (InputAction action, InputState state, uint32_t frameNumber=0)
 Construct an input event.
 
InputAction getAction () const
 Get the input action.
 
InputState getState () const
 Get the input state.
 
uint32_t getFrameNumber () const
 Get the frame number.
 
- Public Member Functions inherited from IEvent
virtual ~IEvent ()=default
 Virtual destructor.
 

Private Attributes

InputAction _action
 The action performed.
 
InputState _state
 The state of the input.
 
uint32_t _frameNumber
 Frame number for network synchronization.
 

Detailed Description

Event representing a player input action.

InputEvent encapsulates all information about a player input:

  • What action was performed (move, shoot, etc.)
  • The state of the input (pressed, released, held)
  • The frame number for network synchronization

This event is used throughout the system:

  • Published by input handling code
  • Subscribed by InputBuffer for prediction
  • Subscribed by Replicator for network transmission
Note
Frame number is critical for client-side prediction and reconciliation

Definition at line 58 of file InputEvent.hpp.

Constructor & Destructor Documentation

◆ InputEvent()

InputEvent::InputEvent ( InputAction  action,
InputState  state,
uint32_t  frameNumber = 0 
)
inline

Construct an input event.

Parameters
actionThe player action (MOVE_UP, SHOOT, etc.)
stateThe input state (PRESSED, RELEASED, HELD)
frameNumberFrame number for network sync (default: 0)

Definition at line 67 of file InputEvent.hpp.

Member Function Documentation

◆ getAction()

InputAction InputEvent::getAction ( ) const
inline

Get the input action.

Returns
The action performed

Definition at line 74 of file InputEvent.hpp.

References _action.

◆ getFrameNumber()

uint32_t InputEvent::getFrameNumber ( ) const
inline

Get the frame number.

Returns
Frame number when input occurred

Definition at line 86 of file InputEvent.hpp.

References _frameNumber.

◆ getState()

InputState InputEvent::getState ( ) const
inline

Get the input state.

Returns
The state of the input

Definition at line 80 of file InputEvent.hpp.

References _state.

Member Data Documentation

◆ _action

InputAction InputEvent::_action
private

The action performed.

Definition at line 89 of file InputEvent.hpp.

Referenced by getAction().

◆ _frameNumber

uint32_t InputEvent::_frameNumber
private

Frame number for network synchronization.

Definition at line 91 of file InputEvent.hpp.

Referenced by getFrameNumber().

◆ _state

InputState InputEvent::_state
private

The state of the input.

Definition at line 90 of file InputEvent.hpp.

Referenced by getState().


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