Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
rtp::client::UISystem Class Reference

System responsible for handling menu interactions. More...

#include <UISystem.hpp>

Inheritance diagram for rtp::client::UISystem:
Collaboration diagram for rtp::client::UISystem:

Public Member Functions

 UISystem (ecs::Registry &registry, sf::RenderWindow &window, Settings &settings)
 
void update (float dt) override
 Update system logic for one frame.
 
void handleEvent (const sf::Event &event)
 
void renderGamepadCursor (sf::RenderWindow &window)
 
- Public Member Functions inherited from rtp::ecs::ISystem
virtual ~ISystem () noexcept=default
 

Private Member Functions

void handleMouseMove (const sf::Vector2i &mousePos)
 
void handleMouseClick (const sf::Vector2i &mousePos)
 
void playClickSound ()
 
bool isMouseOverButton (const ecs::components::ui::Button &button, const sf::Vector2i &mousePos)
 
bool isMouseOverSlider (const ecs::components::ui::Slider &slider, const sf::Vector2i &mousePos)
 
bool isMouseOverDropdown (const ecs::components::ui::Dropdown &dropdown, const sf::Vector2i &mousePos)
 
void updateSliderValue (ecs::components::ui::Slider &slider, const sf::Vector2i &mousePos)
 
int getDropdownOptionAtMouse (const ecs::components::ui::Dropdown &dropdown, const sf::Vector2i &mousePos)
 
bool isMouseOverTextInput (const ecs::components::ui::TextInput &input, const sf::Vector2i &mousePos) const
 
void focusTextInputAt (const sf::Vector2i &mousePos)
 
void clearAllTextInputFocus ()
 
void handleTextEntered (std::uint32_t unicode)
 
void handleKeyPressed (sf::Keyboard::Key key)
 
void updateGamepadCursor (float dt)
 
void handleGamepadInput ()
 

Private Attributes

ecs::Registry_registry
 
sf::RenderWindow & _window
 
Settings_settings
 
sf::Vector2f _gamepadCursorPos
 
bool _gamepadMode {false}
 
sf::Clock _gamepadButtonClock
 

Detailed Description

System responsible for handling menu interactions.

Definition at line 31 of file UISystem.hpp.

Constructor & Destructor Documentation

◆ UISystem()

rtp::client::UISystem::UISystem ( ecs::Registry registry,
sf::RenderWindow &  window,
Settings settings 
)
inline

Definition at line 33 of file UISystem.hpp.

Member Function Documentation

◆ clearAllTextInputFocus()

void rtp::client::UISystem::clearAllTextInputFocus ( )
private

◆ focusTextInputAt()

void rtp::client::UISystem::focusTextInputAt ( const sf::Vector2i &  mousePos)
private

◆ getDropdownOptionAtMouse()

int rtp::client::UISystem::getDropdownOptionAtMouse ( const ecs::components::ui::Dropdown dropdown,
const sf::Vector2i &  mousePos 
)
private

◆ handleEvent()

void rtp::client::UISystem::handleEvent ( const sf::Event &  event)

Definition at line 52 of file UISystem.cpp.

References handleKeyPressed(), and handleTextEntered().

◆ handleGamepadInput()

void rtp::client::UISystem::handleGamepadInput ( )
private

◆ handleKeyPressed()

void rtp::client::UISystem::handleKeyPressed ( sf::Keyboard::Key  key)
private

◆ handleMouseClick()

◆ handleMouseMove()

void rtp::client::UISystem::handleMouseMove ( const sf::Vector2i &  mousePos)
private

◆ handleTextEntered()

void rtp::client::UISystem::handleTextEntered ( std::uint32_t  unicode)
private

◆ isMouseOverButton()

bool rtp::client::UISystem::isMouseOverButton ( const ecs::components::ui::Button button,
const sf::Vector2i &  mousePos 
)
private

◆ isMouseOverDropdown()

bool rtp::client::UISystem::isMouseOverDropdown ( const ecs::components::ui::Dropdown dropdown,
const sf::Vector2i &  mousePos 
)
private

◆ isMouseOverSlider()

bool rtp::client::UISystem::isMouseOverSlider ( const ecs::components::ui::Slider slider,
const sf::Vector2i &  mousePos 
)
private

◆ isMouseOverTextInput()

bool rtp::client::UISystem::isMouseOverTextInput ( const ecs::components::ui::TextInput input,
const sf::Vector2i &  mousePos 
) const
private

◆ playClickSound()

◆ renderGamepadCursor()

void rtp::client::UISystem::renderGamepadCursor ( sf::RenderWindow &  window)

◆ update()

void rtp::client::UISystem::update ( float  deltaTime)
overridevirtual

Update system logic for one frame.

Parameters
registryThe entity registry to operate on
deltaTimeTime elapsed since last update in seconds

Implements rtp::ecs::ISystem.

Definition at line 17 of file UISystem.cpp.

References _gamepadCursorPos, _gamepadMode, _registry, _window, rtp::ecs::Registry::get(), handleGamepadInput(), handleMouseClick(), handleMouseMove(), and updateGamepadCursor().

◆ updateGamepadCursor()

void rtp::client::UISystem::updateGamepadCursor ( float  dt)
private

◆ updateSliderValue()

Member Data Documentation

◆ _gamepadButtonClock

sf::Clock rtp::client::UISystem::_gamepadButtonClock
private

Definition at line 87 of file UISystem.hpp.

◆ _gamepadCursorPos

sf::Vector2f rtp::client::UISystem::_gamepadCursorPos
private

Definition at line 85 of file UISystem.hpp.

Referenced by handleGamepadInput(), renderGamepadCursor(), update(), and updateGamepadCursor().

◆ _gamepadMode

bool rtp::client::UISystem::_gamepadMode {false}
private

Definition at line 86 of file UISystem.hpp.

Referenced by handleGamepadInput(), renderGamepadCursor(), update(), and updateGamepadCursor().

◆ _registry

◆ _settings

Settings& rtp::client::UISystem::_settings
private

Definition at line 83 of file UISystem.hpp.

Referenced by handleGamepadInput(), renderGamepadCursor(), and updateGamepadCursor().

◆ _window

sf::RenderWindow& rtp::client::UISystem::_window
private

Definition at line 82 of file UISystem.hpp.

Referenced by update(), and updateGamepadCursor().


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