|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
#include <InputSystem.hpp>
Public Member Functions | |
| InputSystem (ecs::Registry &r, ecs::Registry &uiRegistry, Settings &settings, ClientNetwork &net, sf::RenderWindow &window) | |
| Constructor for InputSystem. | |
| void | update (float) override |
| Update input system logic for one frame. | |
Public Member Functions inherited from rtp::ecs::ISystem | |
| virtual | ~ISystem () noexcept=default |
Private Types | |
| enum | InputBits : uint8_t { MoveUp = 1 << 0 , MoveDown = 1 << 1 , MoveLeft = 1 << 2 , MoveRight = 1 << 3 , Shoot = 1 << 4 , Reload = 1 << 5 , DebugPowerup = 1 << 6 } |
Private Member Functions | |
| void | playShotSound () |
Private Attributes | |
| ecs::Registry & | _r |
| Reference to the entity registry. | |
| ecs::Registry & | _uiRegistry |
| Reference to the UI registry. | |
| Settings & | _settings |
| Reference to the client settings. | |
| ClientNetwork & | _net |
| Reference to the client network manager. | |
| sf::RenderWindow & | _window |
| Reference to the SFML render window. | |
| uint8_t | _lastMask = 0 |
| Last sent input mask. | |
Definition at line 23 of file InputSystem.hpp.
|
private |
| Enumerator | |
|---|---|
| MoveUp | Bitmask for input directions. |
| MoveDown | |
| MoveLeft | |
| MoveRight | |
| Shoot | |
| Reload | |
| DebugPowerup | Debug key to spawn powerup. |
Definition at line 47 of file InputSystem.hpp.
|
explicit |
Constructor for InputSystem.
| r | Reference to the entity registry |
| settings | Reference to the client settings |
| net | Reference to the client network manager |
| window | Reference to the SFML render window |
Definition at line 20 of file InputSystem.cpp.
|
private |
Definition at line 128 of file InputSystem.cpp.
References _r, _settings, rtp::ecs::Registry::add(), rtp::log::error(), rtp::client::Settings::getSfxVolume(), rtp::ecs::components::audio::SoundEvent::soundPath, rtp::ecs::Registry::spawn(), and rtp::ecs::components::audio::SoundEvent::volume.
Referenced by update().
|
overridevirtual |
Update input system logic for one frame.
| deltaTime | Time elapsed since last update in seconds |
Implements rtp::ecs::ISystem.
Definition at line 27 of file InputSystem.cpp.
References _lastMask, _net, _settings, _uiRegistry, _window, DebugPowerup, rtp::ecs::Registry::get(), rtp::client::Settings::getGamepadDeadzone(), rtp::client::Settings::getGamepadEnabled(), rtp::client::Settings::getGamepadReloadButton(), rtp::client::Settings::getGamepadShootButton(), rtp::client::Settings::getKey(), rtp::log::info(), rtp::net::InputTick, rtp::client::ClientNetwork::isUdpReady(), MoveDown, rtp::client::MoveDown, MoveLeft, rtp::client::MoveLeft, MoveRight, rtp::client::MoveRight, MoveUp, rtp::client::MoveUp, playShotSound(), Reload, rtp::client::Reload, rtp::client::ClientNetwork::sendPacket(), Shoot, rtp::client::Shoot, and rtp::net::UDP.
|
private |
|
private |
Reference to the client network manager.
Definition at line 60 of file InputSystem.hpp.
Referenced by update().
|
private |
Reference to the entity registry.
Definition at line 57 of file InputSystem.hpp.
Referenced by playShotSound().
|
private |
Reference to the client settings.
Definition at line 59 of file InputSystem.hpp.
Referenced by playShotSound(), and update().
|
private |
Reference to the UI registry.
Definition at line 58 of file InputSystem.hpp.
Referenced by update().
|
private |
Reference to the SFML render window.
Definition at line 61 of file InputSystem.hpp.
Referenced by update().