|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
System responsible for handling menu interactions. More...
#include <UISystem.hpp>
Public Member Functions | |
| UISystem (ecs::Registry ®istry, 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 |
System responsible for handling menu interactions.
Definition at line 31 of file UISystem.hpp.
|
inline |
Definition at line 33 of file UISystem.hpp.
|
private |
Definition at line 359 of file UISystem.cpp.
References _registry, rtp::ecs::Registry::get(), and rtp::ecs::components::ui::TextInput::value.
Referenced by handleKeyPressed().
|
private |
Definition at line 374 of file UISystem.cpp.
References _registry, rtp::ecs::Registry::get(), isMouseOverTextInput(), and rtp::ecs::components::ui::TextInput::value.
|
private |
Definition at line 316 of file UISystem.cpp.
References rtp::ecs::components::ui::Dropdown::options, rtp::ecs::components::ui::Dropdown::position, rtp::ecs::components::ui::Dropdown::size, rtp::Vec2< T >::x, and rtp::Vec2< T >::y.
Referenced by handleMouseClick().
| void rtp::client::UISystem::handleEvent | ( | const sf::Event & | event | ) |
Definition at line 52 of file UISystem.cpp.
References handleKeyPressed(), and handleTextEntered().
|
private |
Definition at line 550 of file UISystem.cpp.
References _gamepadCursorPos, _gamepadMode, _settings, rtp::client::Settings::getGamepadEnabled(), rtp::client::Settings::getGamepadValidateButton(), and handleMouseClick().
Referenced by update().
|
private |
Definition at line 456 of file UISystem.cpp.
References _registry, clearAllTextInputFocus(), rtp::ecs::Registry::get(), and rtp::ecs::components::ui::TextInput::value.
Referenced by handleEvent().
|
private |
Definition at line 81 of file UISystem.cpp.
References _registry, rtp::ecs::Registry::get(), getDropdownOptionAtMouse(), rtp::log::info(), rtp::ecs::components::ui::Slider::isDragging, isMouseOverButton(), isMouseOverDropdown(), isMouseOverSlider(), isMouseOverTextInput(), playClickSound(), rtp::ecs::components::ui::Pressed, updateSliderValue(), and rtp::ecs::components::ui::TextInput::value.
Referenced by handleGamepadInput(), and update().
|
private |
Definition at line 62 of file UISystem.cpp.
References _registry, rtp::ecs::Registry::get(), rtp::ecs::components::ui::Hovered, rtp::ecs::components::ui::Idle, isMouseOverButton(), and rtp::ecs::components::ui::Button::state.
Referenced by update().
|
private |
Definition at line 399 of file UISystem.cpp.
References _registry, rtp::ecs::Registry::get(), and rtp::ecs::components::ui::TextInput::value.
Referenced by handleEvent().
|
private |
Definition at line 254 of file UISystem.cpp.
References rtp::ecs::components::ui::Button::position, rtp::ecs::components::ui::Button::size, rtp::Vec2< T >::x, and rtp::Vec2< T >::y.
Referenced by handleMouseClick(), and handleMouseMove().
|
private |
Definition at line 286 of file UISystem.cpp.
References rtp::ecs::components::ui::Dropdown::position, rtp::ecs::components::ui::Dropdown::size, rtp::Vec2< T >::x, and rtp::Vec2< T >::y.
Referenced by handleMouseClick().
|
private |
Definition at line 270 of file UISystem.cpp.
References rtp::ecs::components::ui::Slider::position, rtp::ecs::components::ui::Slider::size, rtp::Vec2< T >::x, and rtp::Vec2< T >::y.
Referenced by handleMouseClick().
|
private |
Definition at line 343 of file UISystem.cpp.
References rtp::ecs::components::ui::TextInput::position, rtp::ecs::components::ui::TextInput::size, rtp::Vec2< T >::x, and rtp::Vec2< T >::y.
Referenced by focusTextInputAt(), and handleMouseClick().
|
private |
Definition at line 589 of file UISystem.cpp.
References _registry, rtp::ecs::Registry::add(), rtp::log::error(), rtp::log::info(), rtp::ecs::components::audio::SoundEvent::pitch, rtp::ecs::components::audio::SoundEvent::soundPath, rtp::ecs::Registry::spawn(), and rtp::ecs::components::audio::SoundEvent::volume.
Referenced by handleMouseClick().
| void rtp::client::UISystem::renderGamepadCursor | ( | sf::RenderWindow & | window | ) |
Definition at line 568 of file UISystem.cpp.
References _gamepadCursorPos, _gamepadMode, _settings, and rtp::client::Settings::getGamepadEnabled().
|
overridevirtual |
Update system logic for one frame.
| registry | The entity registry to operate on |
| deltaTime | Time 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().
|
private |
Definition at line 498 of file UISystem.cpp.
References _gamepadCursorPos, _gamepadMode, _settings, _window, rtp::client::Settings::getGamepadCursorSpeed(), rtp::client::Settings::getGamepadDeadzone(), and rtp::client::Settings::getGamepadEnabled().
Referenced by update().
|
private |
Definition at line 302 of file UISystem.cpp.
References rtp::ecs::components::ui::Slider::currentValue, rtp::ecs::components::ui::Slider::maxValue, rtp::ecs::components::ui::Slider::minValue, rtp::ecs::components::ui::Slider::onChange, rtp::ecs::components::ui::Slider::position, rtp::ecs::components::ui::Slider::size, and rtp::Vec2< T >::x.
Referenced by handleMouseClick().
|
private |
Definition at line 87 of file UISystem.hpp.
|
private |
Definition at line 85 of file UISystem.hpp.
Referenced by handleGamepadInput(), renderGamepadCursor(), update(), and updateGamepadCursor().
|
private |
Definition at line 86 of file UISystem.hpp.
Referenced by handleGamepadInput(), renderGamepadCursor(), update(), and updateGamepadCursor().
|
private |
Definition at line 81 of file UISystem.hpp.
Referenced by clearAllTextInputFocus(), focusTextInputAt(), handleKeyPressed(), handleMouseClick(), handleMouseMove(), handleTextEntered(), playClickSound(), and update().
|
private |
Definition at line 83 of file UISystem.hpp.
Referenced by handleGamepadInput(), renderGamepadCursor(), and updateGamepadCursor().
|
private |
Definition at line 82 of file UISystem.hpp.
Referenced by update(), and updateGamepadCursor().