LDKSceneSystems
struct LDKSceneSystems;
Scene data and TML serialization.
struct LDKSceneSystems;
#define LDK_SCENE_TML_VERSION 1
#define LDK_SCENE_NULL_ENTITY_ID(-1)
Entry in the Scene Manager catalog. Scene pointers returned by the Scene Manager refer to its internal catalog and remain valid until the catalog is overridden or the manager is terminated.
typedef struct LDKScene{
LDKAssetPath path;
XSmallstr name;
u32 index;
}LDKScene;
typedef struct LDKSceneProperties{
rgba32 ambient_color;
float ambient_intensity;
}LDKSceneProperties;
typedef struct LDKSceneResult{
bool ok;
char error[256];
}LDKSceneResult;
Set default values for scene properties.
LDK_API void ldk_scene_properties_defaults(LDKSceneProperties *properties);
LDKSceneProperties *propertiesGet the scene properties.
LDK_API const LDKSceneProperties * ldk_scene_properties_get(void);
Pointer to the requested object or data; NULL when unavailable.
Set the scene properties.
LDK_API bool ldk_scene_properties_set(const LDKSceneProperties *properties);
const LDKSceneProperties *propertiesTrue if the operation succeeds; false otherwise.
Reset the state of the scene properties.
LDK_API void ldk_scene_properties_reset(void);
Clear the state of the scene result.
LDK_API void ldk_scene_result_clear(LDKSceneResult *result);
LDKSceneResult *resultStore a scene diagnostic message in the result.
LDK_API void ldk_scene_result_set_error(
LDKSceneResult *result,
const char *error
);
LDKSceneResult *resultconst char *errorCallback for reporting a scene diagnostic.
typedef void(*LDKSceneDiagnosticFn)(const char *message, void *user);
messageuserSet the scene diagnostic handler.
LDK_API void ldk_scene_diagnostic_handler_set(
LDKSceneDiagnosticFn handler,
void *user
);
LDKSceneDiagnosticFn handlervoid *userLoads entities and components from a TML string into the current ECS. This function does not clear existing entities and does not roll back entities created before an error. A caller performing a full scene replace is responsible for clearing the ECS before the call and after a failed call.
LDK_API bool ldk_scene_from_tml(
const char *source,
LDKSceneResult *result
);
const char *sourceLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Reads a TML file and loads it into the current ECS. This function has the same ECS ownership semantics as ldk_scene_from_tml().
LDK_API bool ldk_scene_load_tml_file(
const char *path,
LDKSceneResult *result
);
const char *pathLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Load entities and scene-owned system data together, resolving references with the same entity map. Systems is initialized with {0}; on failure its previous contents are unchanged. The caller owns ECS cleanup on failure, and must stop old systems before replacing a scene. No initialize runs.
LDK_API bool ldk_scene_from_tml_with_systems(
const char *source,
struct LDKSceneSystems *systems,
LDKSceneResult *result
);
const char *sourcestruct LDKSceneSystems *systemsLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Load scene TML file with systems.
LDK_API bool ldk_scene_load_tml_file_with_systems(
const char *path,
struct LDKSceneSystems *systems,
LDKSceneResult *result
);
const char *pathstruct LDKSceneSystems *systemsLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Serialize a scene and its system configuration to TML.
LDK_API bool ldk_scene_to_tml_with_systems(
XStrBuilder *out,
const struct LDKSceneSystems *systems,
LDKSceneResult *result
);
XStrBuilder *outconst struct LDKSceneSystems *systemsLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Serializes the current ECS contents to TML.
LDK_API bool ldk_scene_to_tml(
XStrBuilder *out,
LDKSceneResult *result
);
XStrBuilder *outLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Serializes the current ECS contents and writes them to a TML file.
LDK_API bool ldk_scene_save_tml_file(
const char *path,
LDKSceneResult *result
);
const char *pathLDKSceneResult *resultTrue if the operation succeeds; false otherwise.
Resolve the runtime component type for reflected scene metadata.
LDK_API u32 ldk_scene_component_meta_runtime_type(const LDKComponentMeta *meta);
const LDKComponentMeta *metaThe resulting numeric value.
Find serialized component metadata for a runtime type.
LDK_API const LDKComponentMeta * ldk_scene_component_meta_find_by_type(
LDKGame *game,
u32 component_type
);
LDKGame *gameu32 component_typePointer to the requested object or data; NULL when unavailable.
Find the scene component field.
LDK_API const LDKComponentFieldMeta * ldk_scene_component_field_find(
const LDKComponentMeta *meta,
const char *field_name
);
const LDKComponentMeta *metaconst char *field_namePointer to the requested object or data; NULL when unavailable.
Check whether a component field may be saved in a scene.
LDK_API bool ldk_scene_component_field_is_serializable(
const LDKComponentMeta *meta,
const LDKComponentFieldMeta *field
);
const LDKComponentMeta *metaconst LDKComponentFieldMeta *fieldTrue when the queried condition holds; false otherwise.