Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
TilemapLayer.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
7#pragma once
8
11#include "../../math/Math.hpp"
13
14namespace esengine::ecs {
15
21ES_ENUM(stability=beta)
28
30ES_ENUM(stability=beta)
31enum class TilemapStaggerAxis : u8 {
32 Y = 0,
33 X = 1,
34};
35
37ES_ENUM(stability=beta)
38enum class TilemapStaggerIndex : u8 {
39 Odd = 0,
40 Even = 1,
41};
42
48ES_COMPONENT(renderable=visible, stability=beta)
51 glm::vec2 cellSize{32.0f, 32.0f};
52
53 ES_PROPERTY(enum=TilemapOrientation, tooltip="Grid layout: orthogonal, isometric, staggered, or hexagonal.")
55
56 ES_PROPERTY(min=0, step=1, shown_when=orientation:Hexagonal,
57 tooltip="Hexagonal side length in px (0 = a regular pointy hex = tileHeight/2). Ignored unless orientation is Hexagonal.")
59
60 ES_PROPERTY(enum=TilemapStaggerAxis, shown_when=orientation:Staggered|Hexagonal,
61 tooltip="Stagger axis (staggered/hex): Y shifts rows, X shifts columns.")
63
64 ES_PROPERTY(enum=TilemapStaggerIndex, shown_when=orientation:Staggered|Hexagonal,
65 tooltip="Which lines carry the half-cell shift (staggered/hex).")
67
69 glm::vec2 originOffset{0.0f, 0.0f};
70
71 ES_PROPERTY(asset = texture)
73
74 ES_PROPERTY(min=1, step=1)
76
77 ES_PROPERTY(step=1, enum_source=sortingLayers)
79
80 ES_PROPERTY(animatable)
81 glm::vec4 tintColor{1.0f, 1.0f, 1.0f, 1.0f};
82
83 ES_PROPERTY(animatable, min=0, max=1, slider, tooltip="Layer transparency (0 = invisible, 1 = opaque).")
84 f32 opacity{1.0f};
85
87 glm::vec2 parallaxFactor{1.0f, 1.0f};
88
90 bool visible{true};
91
93 ES_PROPERTY(optional, tooltip="Receive 2D lights: Light entities light this layer's tiles (flat normal).")
94 bool lit{false};
95
96 // Runtime-only; not ES_PROPERTY so it isn't serialized.
97 bool needsSync{true};
98
99 TilemapLayer() = default;
100};
101
102} // namespace esengine::ecs
Type-safe resource handle system.
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.
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
resource::TextureHandle tileset
bool lit
Lit by the scene's 2D lights (Light), as a Sprite's lit is: flat normal, the layer's tint as the albe...