Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
SpineAnimation.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"
25
26#include <string>
27
28namespace esengine::ecs {
29
30// =============================================================================
31// SpineAnimation Component
32// =============================================================================
33
49ES_COMPONENT(renderable=enabled, stability=beta)
52 ES_PROPERTY(asset = spine_skeleton)
54
56 ES_PROPERTY(asset = spine_atlas)
57 std::string atlasPath;
58
60 ES_PROPERTY(enum_source=spineSkins)
61 std::string skin;
62
64 ES_PROPERTY(enum_source=spineAnimations)
65 std::string animation;
66
68 ES_PROPERTY(min=0)
70
73 bool loop{true};
74
77 bool playing{true};
78
81 bool flipX{false};
82
85 bool flipY{false};
86
89 glm::vec4 color{1.0f, 1.0f, 1.0f, 1.0f};
90
92 ES_PROPERTY(step=1, enum_source=sortingLayers)
94
96 ES_PROPERTY(min=0)
98
100 ES_PROPERTY(asset = material)
102
104 bool enabled{true};
105
108
110 bool needsReload{true};
111
113 SpineAnimation() = default;
114
120 SpineAnimation(const std::string& skelPath, const std::string& atlPath)
121 : skeletonPath(skelPath), atlasPath(atlPath) {}
122};
123
124} // 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_PROPERTY(...)
Mark a field as a property that should be exposed to scripts.
Core type definitions and utilities for ESEngine.
Handle< esengine::spine::SpineSkeletonData > SpineDataHandle
Handle to a Spine skeleton data resource (vestigial — see fwd decl).
Definition Handle.hpp:235
std::int32_t i32
Signed 32-bit integer.
Definition Types.hpp:54
std::uint32_t u32
Unsigned 32-bit integer.
Definition Types.hpp:45
float f32
32-bit floating point
Definition Types.hpp:59
glm::vec4 color
Color tint (RGBA, 0-1 range).
SpineAnimation()=default
Default constructor.
bool playing
Whether animation is currently playing.
bool loop
Whether to loop the animation.
std::string animation
Current animation name.
std::string skin
Current skin name (empty for default).
std::string skeletonPath
Path to skeleton data file (.skel or .json).
f32 skeletonScale
Skeleton scale factor.
resource::SpineDataHandle skeletonData
Handle to cached skeleton data (runtime, not serialized).
u32 material
Custom material ID (0 = use default batch shader).
bool needsReload
Flag indicating skeleton needs to be reloaded.
bool flipY
Flip skeleton vertically.
bool flipX
Flip skeleton horizontally.
std::string atlasPath
Path to atlas file (.atlas).
f32 timeScale
Animation playback speed multiplier.
SpineAnimation(const std::string &skelPath, const std::string &atlPath)
Constructs SpineAnimation with paths.
i32 layer
Sorting layer (higher = rendered on top).