Engine » UI » Canvas module

Adds the core UI functionality and rendering logic.

Architecture

The two main UI components are UIElement and UICanvas. For it to work properly, each UIElement must be a child of a UICanvas, or of another UIElement.

Each UIElement generates a list of drawing commands, UIDrawList, that are then pooled together by the UICanvas at the root of the hierarchy.

Each entry in a draw list contains a UIDrawList::Type and a UIDrawList::Command. The Type holds information that is common for all similar commands, and the Command contains the specifics to that one command. Each entry also has a raw data buffer to hold the data the command needs to pass to the shaders.

After aggregating the draw commands, the UICanvas draws them, grouped by type.

Check out UI for the an example of the UI plugin in use.

Files

file canvas.hpp
Component cubos::engine::UICanvas.
file draw_list.hpp
Class cubos::engine::UIDrawList.
file element.hpp
Component cubos::engine::UIElement.
file expand.hpp
Component cubos::engine::UIExpand.
file horizontal_stretch.hpp
Component cubos::engine::UIHorizontalStretch.
file keep_pixel_size.hpp
Component cubos::engine::UIKeepPixelSize.
file match_height.hpp
Component cubos::engine::UIMatchHeight.
file match_width.hpp
Component cubos::engine::UIMatchWidth.
file native_aspect_ratio.hpp
Component cubos::engine::UINativeAspectRatio.
file plugin.hpp
Plugin entry point.
file vertical_stretch.hpp
Component cubos::engine::UIVerticalStretch.

Classes

struct cubos::engine::UICanvas
Component which represents a target for UI rendering.
class cubos::engine::UIDrawList
Holds a collections of draw commands and their data.
struct cubos::engine::UIDrawList::Type
Describes a UI draw call type.
struct cubos::engine::UIDrawList::Command
Describes a UI draw instruction.
struct cubos::engine::UIDrawList::Entry
Describes a draw commands and how it fits into the draw list carrying it.
class cubos::engine::UIDrawList::EntryBuilder
Builds an Entry.
struct cubos::engine::UIElement
Component which defines the space an element of the UI occupies as a rect.
struct cubos::engine::UIExpand
Component which makes a UI canvas scale to maintain proportions, choosing the dimension which reduces the element sizes on screen.
struct cubos::engine::UIHorizontalStretch
Component which makes a UI element fit horizontally to its parent.
struct cubos::engine::UIKeepPixelSize
Component which makes a UI canvas scale to keep its elements at the same pixel size.
struct cubos::engine::UIMatchHeight
Component which makes a UI canvas scale to maintain vertical proportions.
struct cubos::engine::UIMatchWidth
Component which makes a UI canvas scale to maintain horizontal proportions.
struct cubos::engine::UINativeAspectRatio
Component which makes a UI element keep the aspect ratio of its source.
struct cubos::engine::UIVerticalStretch
Component which makes a UI element fit vertically to its parent.

Functions

auto uiCanvasPlugin(Cubos& cubos) -> CUBOS_ENGINE_API void
Plugin entry function.

Function documentation

CUBOS_ENGINE_API void uiCanvasPlugin(Cubos& cubos)

Plugin entry function.

Parameters
cubos Cubos main class