Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
SpriteMask.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
20#pragma once
21
22#include "../../core/Types.hpp"
24
25namespace esengine::ecs {
26
30ES_COMPONENT(renderable=enabled, stability=beta)
31struct SpriteMask {
33 ES_PROPERTY(min=0, max=1, slider,
34 tooltip="Cut to the sprite's shape instead of its box: fragments below this alpha do not mask.")
36
38 ES_PROPERTY(tooltip="Limit how far this mask reaches; off = every sprite drawn after it.")
39 bool limitRange{false};
40
42 ES_PROPERTY(step=1, enum_source=sortingLayers, shown_when=limitRange:true,
43 tooltip="Last sorting layer this mask reaches.")
45
47 ES_PROPERTY(step=1, min=-128, max=127, shown_when=limitRange:true,
48 tooltip="Last order inside that layer this mask reaches, inclusive.")
50
54 bool enabled{true};
55};
56
57} // namespace esengine::ecs
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_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
float f32
32-bit floating point
Definition Types.hpp:59
A stencil cut from this entity's own Sprite.
bool enabled
Off is not a mask at all: the sprite goes back to being drawn normally, which is what makes "is this ...
i32 rangeEndOrder
Last order WITHIN that layer, inclusive.
i32 rangeEndLayer
Last sorting layer this mask reaches.
bool limitRange
Stop reaching at a stated layer/order instead of running to the end of the frame.
f32 alphaCutoff
Above 0, cut to the sprite's SHAPE — fragments below this alpha do not mask.