![]() |
R-Type
2
Doom but in better
|
Manages input events such as mouse movements, key presses, and window interactions. More...
#include <EventManager.hpp>
Public Member Functions | |
EventManager (const std::uint32_t entityId=0) | |
Constructs an EventManager with an optional entity ID. | |
~EventManager () | |
Destroys the EventManager instance. | |
void | clearEvents () |
Clears all currently stored events if the counter has reached the delay, otherwise, increment it. | |
void | flushEvents () |
Forcefully clear all the stored events. | |
void | processEvents (GUI::ECS::Systems::Window &window, const ActiveScreen ¤tScreen=ActiveScreen::UNKNOWN) |
Processes events from the specified window. | |
const bool | isMouseInFocus () const |
Checks if the mouse is in focus within the window. | |
const bool | isLeftButtonClicked () const |
Checks if the left mouse button is clicked. | |
const bool | isRightButtonClicked () const |
Checks if the right mouse button is clicked. | |
const bool | isKeyPressed (const GUI::ECS::Systems::Key &key) const |
Checks if a specific key is currently pressed. | |
const float | getPositionX () const |
Retrieves the current X position of the mouse. | |
const float | getPositionY () const |
Retrieves the current Y position of the mouse. | |
const std::pair< int, int > | getMousePosition () const |
Retrieves the current position of the mouse as a pair (x, y). | |
const GUI::ECS::Systems::MouseInfo | getMouseInfo () const |
Retrieves the current state of the mouse. | |
const std::vector< GUI::ECS::Systems::Key > | getKeys () const |
Retrieves all currently pressed keys. | |
const std::string | getInfo (const unsigned int indent=0) const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes. | |
void | update (GUI::ECS::Systems::Window &window, const ActiveScreen &screen=ActiveScreen::UNKNOWN) |
Updates the EventManager with events from a window. | |
void | update (const GUI::ECS::Systems::MouseInfo &mouse) |
Updates the EventManager with new mouse information. | |
void | update (const GUI::ECS::Systems::EventManager ©) |
Updates the EventManager by copying data from another instance. | |
EventManager & | operator= (const GUI::ECS::Systems::EventManager ©) |
Assignment operator for the EventManager. | |
![]() | |
EntityNode (const size_t entityId=0) | |
virtual | ~EntityNode ()=default |
virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
![]() | |
size_t | _entityID |
Manages input events such as mouse movements, key presses, and window interactions.
Definition at line 47 of file EventManager.hpp.
GUI::ECS::Systems::EventManager::EventManager | ( | const std::uint32_t | entityId = 0 | ) |
Constructs an EventManager with an optional entity ID.
entityId | The unique ID of the entity. Default is 0. |
Definition at line 17 of file EventManager.cpp.
GUI::ECS::Systems::EventManager::~EventManager | ( | ) |
Destroys the EventManager instance.
Definition at line 22 of file EventManager.cpp.
void GUI::ECS::Systems::EventManager::clearEvents | ( | ) |
Clears all currently stored events if the counter has reached the delay, otherwise, increment it.
Definition at line 112 of file EventManager.cpp.
void GUI::ECS::Systems::EventManager::flushEvents | ( | ) |
Forcefully clear all the stored events.
Definition at line 124 of file EventManager.cpp.
const std::string GUI::ECS::Systems::EventManager::getInfo | ( | const unsigned int | indent = 0 | ) | const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
indent | The level to which the class should be indented in the dump. |
Definition at line 65 of file EventManager.cpp.
const std::vector< GUI::ECS::Systems::Key > GUI::ECS::Systems::EventManager::getKeys | ( | ) | const |
Retrieves all currently pressed keys.
Definition at line 60 of file EventManager.cpp.
const GUI::ECS::Systems::MouseInfo GUI::ECS::Systems::EventManager::getMouseInfo | ( | ) | const |
Retrieves the current state of the mouse.
Definition at line 39 of file EventManager.cpp.
const std::pair< int, int > GUI::ECS::Systems::EventManager::getMousePosition | ( | ) | const |
Retrieves the current position of the mouse as a pair (x, y).
Definition at line 34 of file EventManager.cpp.
const float GUI::ECS::Systems::EventManager::getPositionX | ( | ) | const |
Retrieves the current X position of the mouse.
Definition at line 24 of file EventManager.cpp.
const float GUI::ECS::Systems::EventManager::getPositionY | ( | ) | const |
Retrieves the current Y position of the mouse.
Definition at line 29 of file EventManager.cpp.
const bool GUI::ECS::Systems::EventManager::isKeyPressed | ( | const GUI::ECS::Systems::Key & | key | ) | const |
Checks if a specific key is currently pressed.
key | The key to check. |
Definition at line 102 of file EventManager.cpp.
const bool GUI::ECS::Systems::EventManager::isLeftButtonClicked | ( | ) | const |
Checks if the left mouse button is clicked.
Definition at line 92 of file EventManager.cpp.
const bool GUI::ECS::Systems::EventManager::isMouseInFocus | ( | ) | const |
Checks if the mouse is in focus within the window.
Definition at line 87 of file EventManager.cpp.
const bool GUI::ECS::Systems::EventManager::isRightButtonClicked | ( | ) | const |
Checks if the right mouse button is clicked.
Definition at line 97 of file EventManager.cpp.
GUI::ECS::Systems::EventManager & GUI::ECS::Systems::EventManager::operator= | ( | const GUI::ECS::Systems::EventManager & | copy | ) |
Assignment operator for the EventManager.
copy | The EventManager instance to assign from. |
Definition at line 173 of file EventManager.cpp.
void GUI::ECS::Systems::EventManager::processEvents | ( | GUI::ECS::Systems::Window & | window, |
const ActiveScreen & | currentScreen = ActiveScreen::UNKNOWN ) |
Processes events from the specified window.
window | The window from which events will be processed. |
currentScreen | The screen that is currently in use. |
Definition at line 133 of file EventManager.cpp.
void GUI::ECS::Systems::EventManager::update | ( | const GUI::ECS::Systems::EventManager & | copy | ) |
Updates the EventManager by copying data from another instance.
copy | The EventManager instance to copy from. |
Definition at line 54 of file EventManager.cpp.
void GUI::ECS::Systems::EventManager::update | ( | const GUI::ECS::Systems::MouseInfo & | mouse | ) |
Updates the EventManager with new mouse information.
mouse | The updated mouse information. |
Definition at line 49 of file EventManager.cpp.
void GUI::ECS::Systems::EventManager::update | ( | GUI::ECS::Systems::Window & | window, |
const ActiveScreen & | screen = ActiveScreen::UNKNOWN ) |
Updates the EventManager with events from a window.
window | The window to retrieve events from. |
screen | The screen that is currently in use. |
Definition at line 44 of file EventManager.cpp.