KroysSceneApi
Entities, transforms, components and reflected fields of a world. Reading needs permission scene.read, editing scene.write. Edits of the editor document are undoable: each call is one undo step, or editor->BeginTransaction groups several. The document is refused during Play (KROYS_E_STATE); runtime systems get the game world in their tick.
Declaration
Declared in kroys/kroys_plugin.h.
kroys_plugin.h
typedef struct KroysSceneApi { ... } KroysSceneApi;
Members
#uint32_t structSize;Size of this struct as the writer compiled it (sizeof); the reader uses it to detect members appended by later minor versions.
#uint32_t reserved;Padding reserved for later use; leave it 0.
#KroysComponentType (KROYS_CALL* FindComponentType)(KroysContext context, const char* typeName);Any registered component: engine ("TransformComponent") or plugin ("Plugin.Id.Name").
#uint32_t (KROYS_CALL* EntityCount)(KroysContext context, KroysWorld world);Number of entities in the world.
#KroysEntity (KROYS_CALL* EntityAt)(KroysContext context, KroysWorld world, uint32_t index);The entity at index (0 .. EntityCount - 1); 0 past the end.
#int32_t (KROYS_CALL* IsAlive)(KroysContext context, KroysWorld world, KroysEntity entity);Nonzero while the entity exists.
#KroysEntity (KROYS_CALL* FindByName)(KroysContext context, KroysWorld world, const char* name);The first entity with this name; 0 when none.
#KroysEntity (KROYS_CALL* FindByGuid)(KroysContext context, KroysWorld world, const KroysGuid* guid);The entity with this persistent GUID; 0 when none.
#KroysResult (KROYS_CALL* CreateEntity)(KroysContext context, KroysWorld world, const char* name, KroysEntity parent, KroysEntity* outEntity);Creates an entity (with a transform) under parent (0: a root entity); its id in *outEntity.
#KroysResult (KROYS_CALL* DestroyEntity)(KroysContext context, KroysWorld world, KroysEntity entity);Destroys an entity and its children.
#const char* (KROYS_CALL* GetName)(KroysContext context, KroysWorld world, KroysEntity entity);The entity's name (host string).
#KroysResult (KROYS_CALL* SetName)(KroysContext context, KroysWorld world, KroysEntity entity, const char* name);Renames an entity.
#KroysResult (KROYS_CALL* GetGuid)(KroysContext context, KroysWorld world, KroysEntity entity, KroysGuid* outGuid);The entity's persistent GUID.
#KroysEntity (KROYS_CALL* GetParent)(KroysContext context, KroysWorld world, KroysEntity entity);The parent; 0 for a root entity.
#KroysResult (KROYS_CALL* SetParent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysEntity parent);Re-parents an entity (0: makes it a root entity).
#KroysResult (KROYS_CALL* GetTransform)(KroysContext context, KroysWorld world, KroysEntity entity, KroysTransform* outTransform);The local transform.
#KroysResult (KROYS_CALL* SetTransform)(KroysContext context, KroysWorld world, KroysEntity entity, const KroysTransform* transform);Sets the local transform.
#int32_t (KROYS_CALL* HasComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type);Nonzero when the entity has the component.
#KroysResult (KROYS_CALL* AddComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type);Adds a component with its default values.
#KroysResult (KROYS_CALL* RemoveComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type);Removes a component.
#KroysResult (KROYS_CALL* GetField)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type, const char* path, KroysValue* outValue);Reflected field by path ("speed", "transform.position"). Strings in outValue are host strings (valid until the next host call on this thread).
#KroysResult (KROYS_CALL* SetField)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type, const char* path, const KroysValue* value);Sets a reflected field by path; the value's type must match the field (INT for integers, FLOAT for floats, ...).
#uint32_t (KROYS_CALL* QueryEntities)(KroysContext context, KroysWorld world, KroysComponentType type, KroysEntity* outEntities, uint32_t capacity);Entities with the component; writes at most capacity, returns the total count.
#uint32_t (KROYS_CALL* ComponentTypeCount)(KroysContext context);Number of registered component types (engine and plugin).
#KroysComponentType (KROYS_CALL* ComponentTypeAt)(KroysContext context, uint32_t index);The component type at index (0 .. ComponentTypeCount - 1); 0 past the end.
#KroysResult (KROYS_CALL* GetComponentTypeInfo)(KroysContext context, KroysComponentType type, KroysComponentTypeInfo* outInfo);Name, display name, category and flags of a component type.
#uint32_t (KROYS_CALL* FieldCount)(KroysContext context, KroysComponentType type);Number of reflected fields of a component type (nested structs flattened).
#KroysResult (KROYS_CALL* GetFieldInfo)(KroysContext context, KroysComponentType type, uint32_t index, KroysFieldInfo* outInfo);The reflected field at index (0 .. FieldCount - 1).
Members
uint32_t structSize; uint32_t reserved; KroysComponentType (KROYS_CALL* FindComponentType)(KroysContext context, const char* typeName); uint32_t (KROYS_CALL* EntityCount)(KroysContext context, KroysWorld world); KroysEntity (KROYS_CALL* EntityAt)(KroysContext context, KroysWorld world, uint32_t index); int32_t (KROYS_CALL* IsAlive)(KroysContext context, KroysWorld world, KroysEntity entity); KroysEntity (KROYS_CALL* FindByName)(KroysContext context, KroysWorld world, const char* name); KroysEntity (KROYS_CALL* FindByGuid)(KroysContext context, KroysWorld world, const KroysGuid* guid); KroysResult (KROYS_CALL* CreateEntity)(KroysContext context, KroysWorld world, const char* name, KroysEntity parent, KroysEntity* outEntity); KroysResult (KROYS_CALL* DestroyEntity)(KroysContext context, KroysWorld world, KroysEntity entity); const char* (KROYS_CALL* GetName)(KroysContext context, KroysWorld world, KroysEntity entity); KroysResult (KROYS_CALL* SetName)(KroysContext context, KroysWorld world, KroysEntity entity, const char* name); KroysResult (KROYS_CALL* GetGuid)(KroysContext context, KroysWorld world, KroysEntity entity, KroysGuid* outGuid); KroysEntity (KROYS_CALL* GetParent)(KroysContext context, KroysWorld world, KroysEntity entity); KroysResult (KROYS_CALL* SetParent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysEntity parent); KroysResult (KROYS_CALL* GetTransform)(KroysContext context, KroysWorld world, KroysEntity entity, KroysTransform* outTransform); KroysResult (KROYS_CALL* SetTransform)(KroysContext context, KroysWorld world, KroysEntity entity, const KroysTransform* transform); int32_t (KROYS_CALL* HasComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type); KroysResult (KROYS_CALL* AddComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type); KroysResult (KROYS_CALL* RemoveComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type); KroysResult (KROYS_CALL* GetField)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type, const char* path, KroysValue* outValue); KroysResult (KROYS_CALL* SetField)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type, const char* path, const KroysValue* value); uint32_t (KROYS_CALL* QueryEntities)(KroysContext context, KroysWorld world, KroysComponentType type, KroysEntity* outEntities, uint32_t capacity); uint32_t (KROYS_CALL* ComponentTypeCount)(KroysContext context); KroysComponentType (KROYS_CALL* ComponentTypeAt)(KroysContext context, uint32_t index); KroysResult (KROYS_CALL* GetComponentTypeInfo)(KroysContext context, KroysComponentType type, KroysComponentTypeInfo* outInfo); uint32_t (KROYS_CALL* FieldCount)(KroysContext context, KroysComponentType type); KroysResult (KROYS_CALL* GetFieldInfo)(KroysContext context, KroysComponentType type, uint32_t index, KroysFieldInfo* outInfo);
KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.