|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Reflection and metadata system for automatic binding generation. More...

Go to the source code of this file.
Classes | |
| struct | esengine::is_component< T > |
| Type trait to detect if a type is a reflected component. More... | |
Namespaces | |
| namespace | esengine |
Macros | |
| #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. | |
| #define | ES_METHOD(...) |
| Mark a method that should be exposed to scripts. | |
| #define | ES_ENUM(...) |
| Mark an enum that should be exposed to scripts. | |
| #define | ES_CONST(...) |
| Mark a constant that CROSSES the boundary, so EHT emits its TS twin. | |
| #define | ES_ENUM_VALUE(name) |
| Mark an enum value for explicit naming in bindings. | |
| #define | ES_REFLECT_BEGIN |
| Begin a reflection block for the binding generator. | |
| #define | ES_REFLECT_END |
| End a reflection block for the binding generator. | |
Functions | |
| template<typename T> | |
| constexpr const char * | esengine::component_name () |
| Get the script name for a component type. | |
Variables | |
| template<typename T> | |
| constexpr bool | esengine::is_component_v = is_component<T>::value |
| Helper variable template for is_component. | |
Reflection and metadata system for automatic binding generation.
Provides macros for marking components and properties that should be automatically exposed to scripting languages. Uses a declarative macro-based approach for code generation.
Definition in file Reflection.hpp.
| #define ES_COMPONENT | ( | ... | ) |
Mark a struct/class as a component that should be exposed to scripts.
This macro generates metadata that the binding generator tool uses to automatically create JavaScript/TypeScript bindings. Place this macro immediately before the struct/class definition.
ES_COMPONENT(renderable=<field>, transient) states what is true of the COMPONENT, as ES_PROPERTY does for a field; both realms read it out of the generated COMPONENT_META. renderable names the bool gating this component's drawing — a hard EHT error unless that bool exists.
stability=public|beta|experimental is the SDK tier of the generated <Name>Data interface, declared here because the generated file is not editable and an untagged symbol is experimental by default.
Definition at line 46 of file Reflection.hpp.
Referenced by esengine::ecs::MeshMorph::MeshMorph(), and esengine::ecs::SpringBone::operator==().
| #define ES_CONST | ( | ... | ) |
Mark a constant that CROSSES the boundary, so EHT emits its TS twin.
Hand-copied, such a constant does not fail when it drifts — a wrong mask decodes a stored cell into a different tile. Marked, it has one author and joins the ABI layout hash. ts=<Name> renames the generated symbol; hex emits the value as hex, for a mask.
Definition at line 129 of file Reflection.hpp.
| #define ES_ENUM | ( | ... | ) |
Mark an enum that should be exposed to scripts.
Enums marked with this macro will be available as TypeScript enums with proper type checking.
stability=public|beta|experimental is the SDK tier of the generated enum. A component's fields are made of these, so an enum weaker than the component naming it is a promise with a hole where its vocabulary should be. Untagged means experimental, as everywhere else.
Definition at line 119 of file Reflection.hpp.
| #define ES_ENUM_VALUE | ( | name | ) |
Mark an enum value for explicit naming in bindings.
Use this to provide custom names for enum values in scripts, or to document their meaning for the binding generator.
| name | Optional custom name for the enum value |
Definition at line 139 of file Reflection.hpp.
| #define ES_METHOD | ( | ... | ) |
Mark a method that should be exposed to scripts.
Methods marked with this macro will be callable from JavaScript/TypeScript. Works for both member functions and static functions.
| ... | Optional attributes (e.g., "const", "static") |
Definition at line 106 of file Reflection.hpp.
| #define ES_PROPERTY | ( | ... | ) |
Mark a field as a property that should be exposed to scripts.
Properties marked with this macro will be accessible from JavaScript/TypeScript with automatic getter/setter generation. Only works inside ES_COMPONENT() marked types.
This is the single authoring site for a field's editor/serialization metadata (RC9-1): the value lives in the struct, the presentation policy lives in the annotation, and EHT generates both the TS metadata and the C++ editor schema from it. Vocabulary parsed/validated by EHT:
Semantics (flags):
Editor presentation:
Serialization / runtime policy:
Malformed known metadata (a non-numeric min=, slider without a range, invalidates=/normalized_of= naming no field) is a hard EHT error, not a silent drop.
Examples: ES_PROPERTY(asset=texture) ES_PROPERTY(animatable, anim_flag=ANIM_POS_X) ES_PROPERTY(min=0, max=180, unit="°", advanced, category="Spot") ES_PROPERTY(invalidates=needsReload)
Definition at line 95 of file Reflection.hpp.
| #define ES_REFLECT_BEGIN |
Begin a reflection block for the binding generator.
The binding generator tool scans for blocks between ES_REFLECT_BEGIN and ES_REFLECT_END to find types that need bindings. This is used in header files.
Definition at line 152 of file Reflection.hpp.
| #define ES_REFLECT_END |
End a reflection block for the binding generator.
Definition at line 157 of file Reflection.hpp.