KROYSDOCS
HomeWhat's newv0.1.0
C/C++ SDK / C ABI · Scene (all targets; permission scene.read / scene.write) / KroysSceneApi

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.

Kindstruct
Headerkroys/kroys_plugin.h
Members28
Functions26
DECLARATION

Declaration

Declared in kroys/kroys_plugin.h.

kroys_plugin.h
typedef struct KroysSceneApi { ... } KroysSceneApi;
REFERENCE

Members

Fields
#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.

field
#uint32_t reserved;

Padding reserved for later use; leave it 0.

field
Functions
#KroysComponentType (KROYS_CALL* FindComponentType)(KroysContext context, const char* typeName);

Any registered component: engine ("TransformComponent") or plugin ("Plugin.Id.Name").

function pointer
#uint32_t (KROYS_CALL* EntityCount)(KroysContext context, KroysWorld world);

Number of entities in the world.

function pointer
#KroysEntity (KROYS_CALL* EntityAt)(KroysContext context, KroysWorld world, uint32_t index);

The entity at index (0 .. EntityCount - 1); 0 past the end.

function pointer
#int32_t (KROYS_CALL* IsAlive)(KroysContext context, KroysWorld world, KroysEntity entity);

Nonzero while the entity exists.

function pointer
#KroysEntity (KROYS_CALL* FindByName)(KroysContext context, KroysWorld world, const char* name);

The first entity with this name; 0 when none.

function pointer
#KroysEntity (KROYS_CALL* FindByGuid)(KroysContext context, KroysWorld world, const KroysGuid* guid);

The entity with this persistent GUID; 0 when none.

function pointer
#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.

function pointer
#KroysResult (KROYS_CALL* DestroyEntity)(KroysContext context, KroysWorld world, KroysEntity entity);

Destroys an entity and its children.

function pointer
#const char* (KROYS_CALL* GetName)(KroysContext context, KroysWorld world, KroysEntity entity);

The entity's name (host string).

function pointer
#KroysResult (KROYS_CALL* SetName)(KroysContext context, KroysWorld world, KroysEntity entity, const char* name);

Renames an entity.

function pointer
#KroysResult (KROYS_CALL* GetGuid)(KroysContext context, KroysWorld world, KroysEntity entity, KroysGuid* outGuid);

The entity's persistent GUID.

function pointer
#KroysEntity (KROYS_CALL* GetParent)(KroysContext context, KroysWorld world, KroysEntity entity);

The parent; 0 for a root entity.

function pointer
#KroysResult (KROYS_CALL* SetParent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysEntity parent);

Re-parents an entity (0: makes it a root entity).

function pointer
#KroysResult (KROYS_CALL* GetTransform)(KroysContext context, KroysWorld world, KroysEntity entity, KroysTransform* outTransform);

The local transform.

function pointer
#KroysResult (KROYS_CALL* SetTransform)(KroysContext context, KroysWorld world, KroysEntity entity, const KroysTransform* transform);

Sets the local transform.

function pointer
#int32_t (KROYS_CALL* HasComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type);

Nonzero when the entity has the component.

function pointer
#KroysResult (KROYS_CALL* AddComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type);

Adds a component with its default values.

function pointer
#KroysResult (KROYS_CALL* RemoveComponent)(KroysContext context, KroysWorld world, KroysEntity entity, KroysComponentType type);

Removes a component.

function pointer
#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).

function pointer
#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, ...).

function pointer
#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.

function pointer
#uint32_t (KROYS_CALL* ComponentTypeCount)(KroysContext context);

Number of registered component types (engine and plugin).

function pointersince 2.2
#KroysComponentType (KROYS_CALL* ComponentTypeAt)(KroysContext context, uint32_t index);

The component type at index (0 .. ComponentTypeCount - 1); 0 past the end.

function pointersince 2.2
#KroysResult (KROYS_CALL* GetComponentTypeInfo)(KroysContext context, KroysComponentType type, KroysComponentTypeInfo* outInfo);

Name, display name, category and flags of a component type.

function pointersince 2.2
#uint32_t (KROYS_CALL* FieldCount)(KroysContext context, KroysComponentType type);

Number of reflected fields of a component type (nested structs flattened).

function pointersince 2.2
#KroysResult (KROYS_CALL* GetFieldInfo)(KroysContext context, KroysComponentType type, uint32_t index, KroysFieldInfo* outInfo);

The reflected field at index (0 .. FieldCount - 1).

function pointersince 2.2
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.