stdlib/sceneView source ↗
scene
25 items · generated by scribe fromstdlib/scene.fd· synced 2026-11-15
Contents
- EntityTemplate (struct)
- Entity (struct)
- SceneManager (struct)
- scene_manager_create (function)
- scene_register_template (function)
- scene_register_template_flags (function)
- scene_get_template (function)
- scene_find_template (function)
- scene_spawn (function)
- scene_spawn_by_name (function)
- scene_despawn (function)
- scene_get_entity (function)
- scene_find_entity (function)
- scene_entity_count (function)
- scene_count_by_template (function)
- scene_count_by_tag (function)
- scene_update_entity (function)
- scene_set_velocity (function)
- scene_damage (function)
- scene_set_tag (function)
- scene_query_radius (function)
- scene_query_box (function)
- scene_nearest (function)
- scene_clear (function)
- scene_clear_all (function)
EntityTemplate
pub struct EntityTemplate {Fields:
| Name | Type |
|---|---|
name | str |
max_health | i64 |
width | i64 |
height | i64 |
flags | i64 |
Defined at line 20
Entity
pub struct Entity {Fields:
| Name | Type |
|---|---|
id | i64 |
template_id | i64 |
x | f64 |
y | f64 |
vx | f64 |
vy | f64 |
health | i64 |
active | bool |
tag | i64 |
Defined at line 34
SceneManager
pub struct SceneManager {Fields:
| Name | Type |
|---|---|
templates | Vec<EntityTemplate> |
entities | Vec<Entity> |
next_id | i64 |
next_tag | i64 |
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 SceneManagername:strmax_health:i64width:i64height: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 SceneManagername:strmax_health:i64width:i64height:i64flags: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:SceneManagertemplate_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:SceneManagername: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 SceneManagertemplate_id:i64x:f64y: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 SceneManagername:strx:f64y: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 SceneManagerentity_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:SceneManagerentity_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:SceneManagerentity_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:SceneManagertemplate_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:SceneManagertag: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 SceneManagerentity_id:i64dt: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 SceneManagerentity_id:i64vx:f64vy: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 SceneManagerentity_id:i64amount: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 SceneManagerentity_id:i64tag: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:SceneManagerx:f64y:f64radius: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:SceneManagerx0:f64y0:f64x1:f64y1: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:SceneManagerx:f64y: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