Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
rtp::ecs::components::ui::Dropdown Struct Reference

Component for dropdown menu selection. More...

#include <Dropdown.hpp>

Collaboration diagram for rtp::ecs::components::ui::Dropdown:

Public Member Functions

std::string getSelected () const
 Get currently selected option text.
 

Public Attributes

Vec2f position
 Position of the dropdown.
 
Vec2f size {200.0f, 40.0f}
 Size of the dropdown button.
 
std::vector< std::string > options
 Available options.
 
int selectedIndex {0}
 Currently selected option.
 
std::function< void(int)> onSelect
 Callback when option selected.
 
uint8_t bgColor [3] {100, 100, 100}
 RGB background color.
 
uint8_t hoverColor [3] {120, 120, 120}
 RGB hover color.
 
uint8_t textColor [3] {255, 255, 255}
 RGB text color.
 
bool isOpen {false}
 Is dropdown menu open.
 
int hoveredIndex {-1}
 Currently hovered option.
 
int zIndex {10}
 Rendering order.
 

Detailed Description

Component for dropdown menu selection.

Definition at line 21 of file Dropdown.hpp.

Member Function Documentation

◆ getSelected()

std::string rtp::ecs::components::ui::Dropdown::getSelected ( ) const
inline

Get currently selected option text.

Definition at line 40 of file Dropdown.hpp.

References options, and selectedIndex.

Member Data Documentation

◆ bgColor

uint8_t rtp::ecs::components::ui::Dropdown::bgColor[3] {100, 100, 100}

RGB background color.

Definition at line 29 of file Dropdown.hpp.

◆ hoverColor

uint8_t rtp::ecs::components::ui::Dropdown::hoverColor[3] {120, 120, 120}

RGB hover color.

Definition at line 30 of file Dropdown.hpp.

◆ hoveredIndex

int rtp::ecs::components::ui::Dropdown::hoveredIndex {-1}

Currently hovered option.

Definition at line 34 of file Dropdown.hpp.

◆ isOpen

bool rtp::ecs::components::ui::Dropdown::isOpen {false}

Is dropdown menu open.

Definition at line 33 of file Dropdown.hpp.

◆ onSelect

std::function<void(int)> rtp::ecs::components::ui::Dropdown::onSelect

Callback when option selected.

Definition at line 26 of file Dropdown.hpp.

Referenced by rtp::client::graphics::UiFactory::createDropdown().

◆ options

std::vector<std::string> rtp::ecs::components::ui::Dropdown::options

◆ position

Vec2f rtp::ecs::components::ui::Dropdown::position

◆ selectedIndex

int rtp::ecs::components::ui::Dropdown::selectedIndex {0}

Currently selected option.

Definition at line 25 of file Dropdown.hpp.

Referenced by rtp::client::graphics::UiFactory::createDropdown(), and getSelected().

◆ size

Vec2f rtp::ecs::components::ui::Dropdown::size {200.0f, 40.0f}

◆ textColor

uint8_t rtp::ecs::components::ui::Dropdown::textColor[3] {255, 255, 255}

RGB text color.

Definition at line 31 of file Dropdown.hpp.

◆ zIndex

int rtp::ecs::components::ui::Dropdown::zIndex {10}

Rendering order.

Definition at line 35 of file Dropdown.hpp.


The documentation for this struct was generated from the following file: