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

An interactive, hit-tested button drawn over its element's rect. More...

#include <ui_button.h>

Public Member Functions

const glm::vec4 & colorForState () const
 The background tint for the current state.

Public Attributes

UIShape shape
 Corners, edge and fade of the quad, whatever state colours it.
std::string eventId
 Identifier carried by the UIClickEvent this button fires.
bool interactable = true
 When false: drawn Disabled, ignores the pointer.
bool held = false
 A press began on it and is still down, wherever the pointer is now.
glm::vec2 pointer = glm::vec2(0.0f)
 In the element's reference pixels, from its top-left.
glm::vec2 resolvedSize = glm::vec2(0.0f)
 The element's laid-out size, in the same pixels as pointer.

Detailed Description

An interactive, hit-tested button drawn over its element's rect.

A press released over it enqueues a UIClickEvent carrying eventId; add a UIText on the entity for a label. Also the UI's one drag primitive: a slider is a button over its track reading pointer.x / resolvedSize.x while held.

Member Function Documentation

◆ colorForState()

const glm::vec4 & Vkm::Engine::UIButton::colorForState ( ) const
inline

The background tint for the current state.

Returns
The colour for state.

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