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

Makes an element's children scroll inside it, and clips them to it. More...

#include <ui_scroll.h>

Public Member Functions

glm::vec2 range () const
 How far the content can travel on each axis, never negative; offset's clamp.

Public Attributes

glm::vec2 offset = {0.0f, 0.0f}
 How far the content has scrolled, in canvas reference pixels.
float wheelStep = 60.0f
 Reference pixels the content moves per wheel notch.
glm::vec2 contentSize = {0.0f, 0.0f}
 Extent of the content laid out inside, in reference pixels; resolved, not authored.
glm::vec2 viewSize = {0.0f, 0.0f}
 This element's resolved size, in reference pixels.

Detailed Description

Makes an element's children scroll inside it, and clips them to it.

Children lay out against the element's rect shifted by offset; it clips whether or not UIElement::clipChildren is set. The wheel goes to the nearest scroll view holding whatever is drawn on top under the pointer, and lands on the next frame's layout, since deciding needs the whole frame's rects. A scrollbar is offset / (contentSize - viewSize).

Member Function Documentation

◆ range()

glm::vec2 Vkm::Engine::UIScroll::range ( ) const
inline

How far the content can travel on each axis, never negative; offset's clamp.

Returns
Overflow per axis in reference pixels.

Member Data Documentation

◆ offset

glm::vec2 Vkm::Engine::UIScroll::offset = {0.0f, 0.0f}

How far the content has scrolled, in canvas reference pixels.

Clamped every frame to the overflow, so it can be written freely.

◆ contentSize

glm::vec2 Vkm::Engine::UIScroll::contentSize = {0.0f, 0.0f}

Extent of the content laid out inside, in reference pixels; resolved, not authored.

Measured from what descendants drew, so an empty layout box adds nothing.


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