Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
Canvas.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
15#pragma once
16
17// =============================================================================
18// Includes
19// =============================================================================
20
21#include "../../core/Types.hpp"
23#include "../../math/Math.hpp"
24
25namespace esengine::ecs {
26
27// =============================================================================
28// Scale Mode
29// =============================================================================
30
34ES_ENUM()
42
43// =============================================================================
44// Canvas Component
45// =============================================================================
46
71struct Canvas {
74 glm::uvec2 designResolution{1920, 1080};
75
77 ES_PROPERTY(min=1, tooltip="World pixels per physics meter (Box2D + tile collider scale).")
79
81 ES_PROPERTY(tooltip="How the canvas adapts the design resolution to the screen.")
83
85 ES_PROPERTY(min=0, max=1, slider, tooltip="0 matches width, 1 matches height (Match mode only).")
87
90 glm::vec4 backgroundColor{0.0f, 0.0f, 0.0f, 1.0f};
91
94 ES_PROPERTY(step=1, enum_source=sortingLayers, tooltip="Sorting layer this UI belongs to — cameras cull by it.")
96
97 Canvas() = default;
98};
99
100} // namespace esengine::ecs
Math utilities and GLM configuration for ESEngine.
Reflection and metadata system for automatic binding generation.
#define ES_COMPONENT(...)
Mark a struct/class as a component that should be exposed to scripts.
#define ES_ENUM(...)
Mark an enum that should be exposed to scripts.
#define ES_PROPERTY(...)
Mark a field as a property that should be exposed to scripts.
Core type definitions and utilities for ESEngine.
CanvasScaleMode
Canvas scaling mode for different screen resolutions.
Definition Canvas.hpp:35
std::int32_t i32
Signed 32-bit integer.
Definition Types.hpp:54
std::uint8_t u8
Unsigned 8-bit integer.
Definition Types.hpp:41
float f32
32-bit floating point
Definition Types.hpp:59
glm::vec4 backgroundColor
Background color for letterbox/pillarbox areas.
Definition Canvas.hpp:90
CanvasScaleMode scaleMode
Scaling mode for different screen resolutions.
Definition Canvas.hpp:82
f32 pixelsPerUnit
World pixels per physics meter (e.g., 100 means 100px = 1 Box2D meter).
Definition Canvas.hpp:78
i32 layer
Sorting layer this canvas' UI belongs to, for Camera.cullingMask. Membership only — UI draw order com...
Definition Canvas.hpp:95
f32 matchWidthOrHeight
Match factor for Match scale mode (0 = width, 1 = height).
Definition Canvas.hpp:86
glm::uvec2 designResolution
Design resolution in pixels.
Definition Canvas.hpp:74