vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::UISlider Struct Reference

A value dragged along a UIButton's width: the button is the track. More...

#include <ui_slider.h>

Public Member Functions

float fraction () const
 How far along the track the value is.

Public Attributes

float value = 0.0f
 Write it to set the slider; a drag keeps it within min..max.
float minValue = 0.0f
 At the track's left end.
float maxValue = 1.0f
 At its right end.
float step = 0.0f
 What a drag snaps to, from minValue; 0 is continuous.
EntityId fill {}
 Grown to the value; none for no fill.
EntityId knob {}
 Stood at the value; none for no knob.

Detailed Description

A value dragged along a UIButton's width: the button is the track.

While a press that began on the button is held, the UISystem sets value from where the pointer is across it and enqueues a UIValueEvent when that changes it. Every frame it lays out the parts named: fill grows from the left to the value (the slider owns its UIElement::relativeSize.x) and knob stands at it (UIElement::anchor.x). Both are optional, and are best the track's children so they move with it. What either looks like is the project's.

Member Function Documentation

◆ fraction()

float Vkm::Engine::UISlider::fraction ( ) const
inline

How far along the track the value is.

Returns
0 at minValue to 1 at maxValue; 0 for an empty range.

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