Skip to content

stdlib/ecsView source ↗

ecs

18 items · generated by scribe fromstdlib/ecs.fd· synced 2026-11-15

stdlib/ecs18 items

Contents

ecs_create_entity

pub fn ecs_create_entity() -> i64 {

Returns: i64

Defined at line 27


ecs_entity_count

pub fn ecs_entity_count() -> i64 {

Returns: i64

Defined at line 32


ecs_has

pub fn ecs_has(component_name: str, entity: i64) -> i64 {

Parameters:

  • component_name: str
  • entity: i64

Returns: i64

Defined at line 39


ecs_add

pub fn ecs_add<T>(component_name: str, entity: i64, value: T) {

Parameters:

  • component_name: str
  • entity: i64
  • value: T

Defined at line 45


ecs_get

pub fn ecs_get(component_name: str, entity: i64) -> i64 {

Parameters:

  • component_name: str
  • entity: i64

Returns: i64

Defined at line 51


ecs_remove

pub fn ecs_remove(component_name: str, entity: i64) {

Parameters:

  • component_name: str
  • entity: i64

Defined at line 56


ecs_dispatch_event

pub fn ecs_dispatch_event(event_name: str) {  // Event dispatch is handled by calling __on_<event_name> directly

Parameters:

  • event_name: str

Defined at line 67


ecs_register_component

Register a component type. Called once per component type at startup. In comptime mode, this would generate the storage layout.

pub fn ecs_register_component(component_name: str) -> void {  // The runtime ECS auto-registers components on first use.

Parameters:

  • component_name: str

Returns: void

Defined at line 84


ecs_register_system

Register a system. A system is a function that runs every frame and queries entities with specific components. In comptime mode, this would generate the query iteration code.

pub fn ecs_register_system(system_name: str, handler: fn() -> void) -> void {  // Store the system handler for later execution.

Parameters:

  • system_name: str
  • handler: fn() -> void

Returns: void

Defined at line 91


ecs_run_systems

Run all registered systems. Called once per frame.

pub fn ecs_run_systems() -> void {  // In the runtime, systems are called directly by name.

Returns: void

Defined at line 96


ecs_query_entities

Query entities that have all of the specified components. Returns a Vec of entity IDs. In comptime mode, this would generate specialized iteration code.

pub fn ecs_query_entities(components: str) -> Vec<i64> {

Parameters:

  • components: str

Returns: Vec<i64>

Defined at line 103


ecs_count_with_component

Get the number of entities that have a specific component.

pub fn ecs_count_with_component(component_name: str) -> i64 {

Parameters:

  • component_name: str

Returns: i64

Defined at line 128


ecs_destroy_entity

Destroy an entity and all its components.

pub fn ecs_destroy_entity(entity: i64) -> void {

Parameters:

  • entity: i64

Returns: void

Defined at line 142


ecs_reset

Reset the ECS world — destroy all entities and components.

pub fn ecs_reset() -> void {

Returns: void

Defined at line 152


ecs_frame

Run one frame of the ECS: call all systems, then clean up. This is a convenience function for game loops.

pub fn ecs_frame() -> void {

Returns: void

Defined at line 163


ecs_spawn

Create an entity with a single component (convenience function).

pub fn ecs_spawn<T>(component_name: str, value: T) -> i64 {

Parameters:

  • component_name: str
  • value: T

Returns: i64

Defined at line 169


ecs_spawn2

Create an entity with two components (convenience function).

pub fn ecs_spawn2<T, U>(comp1: str, val1: T, comp2: str, val2: U) -> i64 {

Parameters:

  • comp1: str
  • val1: T
  • comp2: str
  • val2: U

Returns: i64

Defined at line 176


ecs_spawn3

Create an entity with three components (convenience function).

pub fn ecs_spawn3<T, U, V>(comp1: str, val1: T, comp2: str, val2: U, comp3: str, val3: V) -> i64 {

Parameters:

  • comp1: str
  • val1: T
  • comp2: str
  • val2: U
  • comp3: str
  • val3: V

Returns: i64

Defined at line 184


Generated by scribe, the Fides documentation generator