R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
InputEvent.hpp
Go to the documentation of this file.
1
/*
2
** EPITECH PROJECT, 2025
3
** Created by samuelBleau on 26/11/2025.
4
** File description:
5
** InputEvent.hpp
6
*/
7
8
#ifndef INPUTEVENT_HPP
9
#define INPUTEVENT_HPP
10
11
#include <cstdint>
12
#include "Events/IEvent.hpp"
13
20
enum class
InputAction
{
21
MOVE_UP
,
22
MOVE_DOWN
,
23
MOVE_LEFT
,
24
MOVE_RIGHT
,
25
SHOOT
,
26
PAUSE
,
27
QUIT
28
};
29
36
enum class
InputState
{
37
PRESSED
,
38
RELEASED
,
39
HELD
40
};
41
58
class
InputEvent
:
public
IEvent
{
59
public
:
67
InputEvent
(
InputAction
action,
InputState
state, uint32_t frameNumber = 0)
68
:
_action
(action),
_state
(state),
_frameNumber
(frameNumber) {}
69
74
InputAction
getAction
()
const
{
return
_action
; }
75
80
InputState
getState
()
const
{
return
_state
; }
81
86
[[nodiscard]] uint32_t
getFrameNumber
()
const
{
return
_frameNumber
; }
87
88
private
:
89
InputAction
_action
;
90
InputState
_state
;
91
uint32_t
_frameNumber
;
92
};
93
94
#endif
InputAction
InputAction
Available player input actions.
Definition
InputEvent.hpp:20
InputAction::SHOOT
@ SHOOT
Fire weapon.
InputAction::PAUSE
@ PAUSE
Pause/unpause the game.
InputAction::MOVE_RIGHT
@ MOVE_RIGHT
Move player ship to the right.
InputAction::QUIT
@ QUIT
Request to quit the game.
InputAction::MOVE_DOWN
@ MOVE_DOWN
Move player ship downward.
InputAction::MOVE_LEFT
@ MOVE_LEFT
Move player ship to the left.
InputAction::MOVE_UP
@ MOVE_UP
Move player ship upward.
InputState
InputState
State of an input action.
Definition
InputEvent.hpp:36
InputState::RELEASED
@ RELEASED
Input just released this frame.
InputState::PRESSED
@ PRESSED
Input just pressed this frame.
InputState::HELD
@ HELD
Input held down (continuous)
IEvent
Base interface for all event types.
Definition
IEvent.hpp:26
InputEvent
Event representing a player input action.
Definition
InputEvent.hpp:58
InputEvent::getState
InputState getState() const
Get the input state.
Definition
InputEvent.hpp:80
InputEvent::_frameNumber
uint32_t _frameNumber
Frame number for network synchronization.
Definition
InputEvent.hpp:91
InputEvent::_action
InputAction _action
The action performed.
Definition
InputEvent.hpp:89
InputEvent::getAction
InputAction getAction() const
Get the input action.
Definition
InputEvent.hpp:74
InputEvent::getFrameNumber
uint32_t getFrameNumber() const
Get the frame number.
Definition
InputEvent.hpp:86
InputEvent::InputEvent
InputEvent(InputAction action, InputState state, uint32_t frameNumber=0)
Construct an input event.
Definition
InputEvent.hpp:67
InputEvent::_state
InputState _state
The state of the input.
Definition
InputEvent.hpp:90
client
Events
InputEvent
InputEvent.hpp
Generated by
1.9.8