World

World — Structure for storing entities and their components.

Functions

Types and Values

Description

LeecsWorld stores and manages information about entities, including their components and the template they were created from, if any. This amounts to managing the game state.

Each LeecsWorld is tied to a LeecsRegistry, which stores metadata for use in a LeecsWorld, most important being a list of existing components which can then be added to entities in the LeecsWorld.

Functions

leecs_world_new ()

LeecsWorld *
leecs_world_new (LeecsRegistry *registry);

Creates a new empty LeecsWorld and increments the reference counter of registry .

Parameters

registry

LeecsRegistry to use for the LeecsWorld.

[transfer none]

Returns

New LeecsWorld. Free with leecs_world_free().

[transfer full]


leecs_world_free ()

void
leecs_world_free (LeecsWorld *world);

Frees all memory associated with world and decrements the reference counter of the LeecsRegistry used in world .

Parameters

world

LeecsWorld to free.

 

leecs_world_copy ()

LeecsWorld *
leecs_world_copy (const LeecsWorld *world);

Creates a copy of world and increments the reference counter of the LeecsRegistry used in world .

Parameters

world

LeecsWorld to copy.

 

Returns

Copy of world . Free with leecs_world_free().

[transfer full]


leecs_world_get_registry ()

const LeecsRegistry *
leecs_world_get_registry (const LeecsWorld *world);

Gets a reference to the LeecsRegistry used in world .

Parameters

world

LeecsWorld to get LeecsRegistry from.

 

Returns

LeecsRegistry associated with world .

[transfer none]

Types and Values

LeecsWorld

typedef struct _LeecsWorld LeecsWorld;