Skip to content

stdlib/sceneView source ↗

scene

25 items · generated by scribe fromstdlib/scene.fd· synced 2026-11-15

stdlib/scene25 items

Contents

EntityTemplate

pub struct EntityTemplate {

Fields:

NameType
namestr
max_healthi64
widthi64
heighti64
flagsi64

Defined at line 20


Entity

pub struct Entity {

Fields:

NameType
idi64
template_idi64
xf64
yf64
vxf64
vyf64
healthi64
activebool
tagi64

Defined at line 34


SceneManager

pub struct SceneManager {

Fields:

NameType
templatesVec<EntityTemplate>
entitiesVec<Entity>
next_idi64
next_tagi64

Defined at line 56


scene_manager_create

Create a new empty scene manager.

pub fn scene_manager_create() -> SceneManager {

Returns: SceneManager

Defined at line 67


scene_register_template

Register a new entity template. Returns the template ID (index).

pub fn scene_register_template(sm: & mut SceneManager, name: str, max_health: i64, width: i64, height: i64) -> i64 {

Parameters:

  • sm: & mut SceneManager
  • name: str
  • max_health: i64
  • width: i64
  • height: i64

Returns: i64

Defined at line 76


scene_register_template_flags

Register a template with flags. Returns the template ID.

pub fn scene_register_template_flags(sm: & mut SceneManager, name: str, max_health: i64, width: i64, height: i64, flags: i64) -> i64 {

Parameters:

  • sm: & mut SceneManager
  • name: str
  • max_health: i64
  • width: i64
  • height: i64
  • flags: i64

Returns: i64

Defined at line 85


scene_get_template

Get a template by ID.

pub fn scene_get_template(sm: SceneManager, template_id: i64) -> EntityTemplate {

Parameters:

  • sm: SceneManager
  • template_id: i64

Returns: EntityTemplate

Defined at line 94


scene_find_template

Find a template by name. Returns -1 if not found.

pub fn scene_find_template(sm: SceneManager, name: str) -> i64 {

Parameters:

  • sm: SceneManager
  • name: str

Returns: i64

Defined at line 104


scene_spawn

Spawn an entity from a template at a world position. Returns the entity ID.

pub fn scene_spawn(sm: & mut SceneManager, template_id: i64, x: f64, y: f64) -> i64 {

Parameters:

  • sm: & mut SceneManager
  • template_id: i64
  • x: f64
  • y: f64

Returns: i64

Defined at line 119


scene_spawn_by_name

Spawn an entity by template name. Returns the entity ID, or -1 if not found.

pub fn scene_spawn_by_name(sm: & mut SceneManager, name: str, x: f64, y: f64) -> i64 {

Parameters:

  • sm: & mut SceneManager
  • name: str
  • x: f64
  • y: f64

Returns: i64

Defined at line 136


scene_despawn

Despawn (remove) an entity by ID. Returns true if found and removed.

pub fn scene_despawn(sm: & mut SceneManager, entity_id: i64) -> bool {

Parameters:

  • sm: & mut SceneManager
  • entity_id: i64

Returns: bool

Defined at line 145


scene_get_entity

Find an entity by ID. Returns the entity, or a default if not found.

pub fn scene_get_entity(sm: SceneManager, entity_id: i64) -> Entity {

Parameters:

  • sm: SceneManager
  • entity_id: i64

Returns: Entity

Defined at line 163


scene_find_entity

Find the index of an entity by ID. Returns -1 if not found.

pub fn scene_find_entity(sm: SceneManager, entity_id: i64) -> i64 {

Parameters:

  • sm: SceneManager
  • entity_id: i64

Returns: i64

Defined at line 178


scene_entity_count

Count active entities.

pub fn scene_entity_count(sm: SceneManager) -> i64 {

Parameters:

  • sm: SceneManager

Returns: i64

Defined at line 191


scene_count_by_template

Count entities with a specific template.

pub fn scene_count_by_template(sm: SceneManager, template_id: i64) -> i64 {

Parameters:

  • sm: SceneManager
  • template_id: i64

Returns: i64

Defined at line 205


scene_count_by_tag

Count entities with a specific tag.

pub fn scene_count_by_tag(sm: SceneManager, tag: i64) -> i64 {

Parameters:

  • sm: SceneManager
  • tag: i64

Returns: i64

Defined at line 219


scene_update_entity

Update an entity’s position by its velocity (simple Euler integration).

pub fn scene_update_entity(sm: & mut SceneManager, entity_id: i64, dt: f64) -> void {

Parameters:

  • sm: & mut SceneManager
  • entity_id: i64
  • dt: f64

Returns: void

Defined at line 235


scene_set_velocity

Set an entity’s velocity.

pub fn scene_set_velocity(sm: & mut SceneManager, entity_id: i64, vx: f64, vy: f64) -> void {

Parameters:

  • sm: & mut SceneManager
  • entity_id: i64
  • vx: f64
  • vy: f64

Returns: void

Defined at line 245


scene_damage

Apply damage to an entity. Returns true if the entity died.

pub fn scene_damage(sm: & mut SceneManager, entity_id: i64, amount: i64) -> bool {

Parameters:

  • sm: & mut SceneManager
  • entity_id: i64
  • amount: i64

Returns: bool

Defined at line 254


scene_set_tag

Set an entity’s tag (for grouping/filtering).

pub fn scene_set_tag(sm: & mut SceneManager, entity_id: i64, tag: i64) -> void {

Parameters:

  • sm: & mut SceneManager
  • entity_id: i64
  • tag: i64

Returns: void

Defined at line 264


scene_query_radius

Find all entities within a radius of a point. Returns a Vec of entity IDs.

pub fn scene_query_radius(sm: SceneManager, x: f64, y: f64, radius: f64) -> Vec<i64> {

Parameters:

  • sm: SceneManager
  • x: f64
  • y: f64
  • radius: f64

Returns: Vec<i64>

Defined at line 275


scene_query_box

Find all entities within an axis-aligned bounding box.

pub fn scene_query_box(sm: SceneManager, x0: f64, y0: f64, x1: f64, y1: f64) -> Vec<i64> {

Parameters:

  • sm: SceneManager
  • x0: f64
  • y0: f64
  • x1: f64
  • y1: f64

Returns: Vec<i64>

Defined at line 294


scene_nearest

Find the nearest entity to a point. Returns entity ID or -1 if none.

pub fn scene_nearest(sm: SceneManager, x: f64, y: f64) -> i64 {

Parameters:

  • sm: SceneManager
  • x: f64
  • y: f64

Returns: i64

Defined at line 308


scene_clear

Clear all entities (but keep templates).

pub fn scene_clear(sm: & mut SceneManager) -> void {

Parameters:

  • sm: & mut SceneManager

Returns: void

Defined at line 331


scene_clear_all

Clear all entities and templates.

pub fn scene_clear_all(sm: & mut SceneManager) -> void {

Parameters:

  • sm: & mut SceneManager

Returns: void

Defined at line 336


Generated by scribe, the Fides documentation generator