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

A UIButton that is on or off, flipped by its click. More...

#include <ui_toggle.h>

Public Attributes

bool on = false
 Write it to set the toggle.
glm::vec4 onColor = {0.0f, 0.0f, 0.0f, 0.0f}
 The button at rest while on; clear keeps normalColor.
EntityId knob {}
 Slid to the end that says the state; none for no knob.

Detailed Description

A UIButton that is on or off, flipped by its click.

The UISystem flips on and enqueues a UIValueEvent (1 on, 0 off) beside the button's UIClickEvent, so on is already flipped when either is delivered. Every frame it stands knob, if named, at its parent's left end when off and its right when on (the toggle owns its UIElement::anchor.x and pivot.x) - so best the button's child, to slide along the button - and while on draws the button in onColor where it would have drawn normalColor, unless that is clear.


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