vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
ui_canvas.h
1#pragma once
2
3#include <cstdint>
4
5#include "core/reflect.h"
6#include "ecs/entity.h"
7
8namespace Vkm::Engine {
9
10class Scene;
11
18struct UICanvas {
22 enum class ScaleMode : uint8_t {
26 };
27
29 float referenceHeight = 1080.0f;
32 int32_t sortOrder = 0;
34 bool visible = true;
35};
36
48bool hasCanvasAncestor(const Scene& scene, EntityId id);
49
50} // namespace Vkm::Engine
51
52VKM_ENUM_NAMES(::Vkm::Engine::UICanvas::ScaleMode, "Fixed", "ScaleWithHeight")
53
54VKM_REFLECT_BEGIN(::Vkm::Engine::UICanvas)
55 VKM_F(referenceHeight)
56 VKM_F(scaleMode)
57 VKM_F(sortOrder)
58 VKM_F(visible)
59VKM_REFLECT_END()
Central registry managing entities and an open set of component types.
Definition scene.h:29
Names one entity of one Scene, for as long as that slot holds it.
Definition entity.h:23
Root of a screen-space UI layer.
Definition ui_canvas.h:18
ScaleMode
How the canvas maps authored pixels to on-screen pixels.
Definition ui_canvas.h:22
@ Fixed
One authored pixel equals one screen pixel.
Definition ui_canvas.h:23
@ ScaleWithHeight
Scale uniformly by viewportHeight / referenceHeight.
Definition ui_canvas.h:24
@ Count
Sentinel; keep last. Drives the VKM_ENUM_NAMES check.
Definition ui_canvas.h:25
float referenceHeight
Authoring height in pixels; ScaleWithHeight scales against it.
Definition ui_canvas.h:29
int32_t sortOrder
Draw order across canvases; higher draws on top.
Definition ui_canvas.h:32
bool visible
Skip the canvas and its whole subtree when false.
Definition ui_canvas.h:34