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::Slider Struct Reference

Component for a draggable slider control. More...

#include <Slider.hpp>

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

Public Member Functions

float getNormalized () const
 Get normalized value (0-1)
 
void setNormalized (float normalized)
 Set value from normalized (0-1)
 

Public Attributes

Vec2f position
 Position of the slider.
 
Vec2f size {200.0f, 20.0f}
 Size of the slider.
 
float minValue {0.0f}
 Minimum value.
 
float maxValue {1.0f}
 Maximum value.
 
float currentValue {0.5f}
 Current value.
 
std::function< void(float)> onChange
 Callback when value changes.
 
uint8_t trackColor [3] {80, 80, 80}
 RGB color of track.
 
uint8_t fillColor [3] {100, 200, 100}
 RGB color of filled part.
 
uint8_t handleColor [3] {200, 200, 200}
 RGB color of handle.
 
bool isDragging {false}
 Is currently being dragged.
 
int zIndex {5}
 Rendering order.
 

Detailed Description

Component for a draggable slider control.

Definition at line 19 of file Slider.hpp.

Member Function Documentation

◆ getNormalized()

float rtp::ecs::components::ui::Slider::getNormalized ( ) const
inline

Get normalized value (0-1)

Definition at line 38 of file Slider.hpp.

References currentValue, maxValue, and minValue.

◆ setNormalized()

void rtp::ecs::components::ui::Slider::setNormalized ( float  normalized)
inline

Set value from normalized (0-1)

Definition at line 45 of file Slider.hpp.

References currentValue, maxValue, and minValue.

Member Data Documentation

◆ currentValue

float rtp::ecs::components::ui::Slider::currentValue {0.5f}

◆ fillColor

uint8_t rtp::ecs::components::ui::Slider::fillColor[3] {100, 200, 100}

RGB color of filled part.

Definition at line 29 of file Slider.hpp.

◆ handleColor

uint8_t rtp::ecs::components::ui::Slider::handleColor[3] {200, 200, 200}

RGB color of handle.

Definition at line 30 of file Slider.hpp.

◆ isDragging

bool rtp::ecs::components::ui::Slider::isDragging {false}

Is currently being dragged.

Definition at line 32 of file Slider.hpp.

Referenced by rtp::client::UISystem::handleMouseClick().

◆ maxValue

float rtp::ecs::components::ui::Slider::maxValue {1.0f}

◆ minValue

float rtp::ecs::components::ui::Slider::minValue {0.0f}

◆ onChange

std::function<void(float)> rtp::ecs::components::ui::Slider::onChange

Callback when value changes.

Definition at line 25 of file Slider.hpp.

Referenced by rtp::client::graphics::UiFactory::createSlider(), and rtp::client::UISystem::updateSliderValue().

◆ position

Vec2f rtp::ecs::components::ui::Slider::position

◆ size

Vec2f rtp::ecs::components::ui::Slider::size {200.0f, 20.0f}

◆ trackColor

uint8_t rtp::ecs::components::ui::Slider::trackColor[3] {80, 80, 80}

RGB color of track.

Definition at line 28 of file Slider.hpp.

◆ zIndex

int rtp::ecs::components::ui::Slider::zIndex {5}

Rendering order.

Definition at line 33 of file Slider.hpp.


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