stdlib/gameView source ↗
game
23 items · generated by scribe fromstdlib/game.fd· synced 2026-11-15
Contents
- GameConfig (struct)
- game_config_new (function)
- game_config_with_fps (function)
- game_loop (function)
- game_frame (function)
- load_asset (function)
- load_texture (function)
- load_sound (function)
- load_model (function)
- input_key_down (function)
- input_key_up (function)
- input_mouse_move (function)
- render_clear (function)
- render_rect (function)
- render_circle (function)
- render_text (function)
- render_present (function)
- compile_script (function)
- hot_reload (function)
- physics_move (function)
- physics_gravity (function)
- physics_aabb_overlap (function)
GameConfig
Game configuration — timing, window, etc.
pub struct GameConfig {Fields:
| Name | Type |
|---|---|
target_fps | i64 |
frame_time | f64 |
max_entities | i64 |
running | bool |
Defined at line 33
game_config_new
Create a default game configuration.
pub fn game_config_new() -> GameConfig {Returns: GameConfig
Defined at line 44
game_config_with_fps
Create a game configuration with a custom FPS.
pub fn game_config_with_fps(fps: i64) -> GameConfig {Parameters:
fps:i64
Returns: GameConfig
Defined at line 51
game_loop
Run the game loop. Calls update and render functions each frame. Uses a frame allocator for per-frame allocations.
pub fn game_loop(config: GameConfig, update_fn: fn(f64) -> void, render_fn: fn() -> void) -> void {Parameters:
config:GameConfigupdate_fn:fn(f64) -> voidrender_fn:fn() -> void
Returns: void
Defined at line 60
game_frame
Run one frame of the game. Useful for testing.
pub fn game_frame(config: GameConfig, update_fn: fn(f64) -> void, render_fn: fn() -> void) -> void {Parameters:
config:GameConfigupdate_fn:fn(f64) -> voidrender_fn:fn() -> void
Returns: void
Defined at line 72
load_asset
Load an asset from a JSON file. The asset type is determined by the caller (via @derive(Deserialize)). Returns an asset handle.
pub fn load_asset(path: str) -> AssetHandle {Parameters:
path:str
Returns: AssetHandle
Defined at line 90
load_texture
Load a texture asset.
pub fn load_texture(path: str) -> AssetHandle {Parameters:
path:str
Returns: AssetHandle
Defined at line 99
load_sound
Load a sound asset.
pub fn load_sound(path: str) -> AssetHandle {Parameters:
path:str
Returns: AssetHandle
Defined at line 104
load_model
Load a 3D model asset.
pub fn load_model(path: str) -> AssetHandle {Parameters:
path:str
Returns: AssetHandle
Defined at line 109
input_key_down
Dispatch a key down event.
pub fn input_key_down(key: i64) -> void {Parameters:
key:i64
Returns: void
Defined at line 121
input_key_up
Dispatch a key up event.
pub fn input_key_up(key: i64) -> void {Parameters:
key:i64
Returns: void
Defined at line 126
input_mouse_move
Dispatch a mouse move event.
pub fn input_mouse_move(x: i64, y: i64) -> void {Parameters:
x:i64y:i64
Returns: void
Defined at line 131
render_clear
Clear the screen with a color.
pub fn render_clear(r: f64, g: f64, b: f64) -> void { // In a real implementation, this would call the GPU.Parameters:
r:f64g:f64b:f64
Returns: void
Defined at line 141
render_rect
Draw a rectangle.
pub fn render_rect(x: f64, y: f64, w: f64, h: f64, r: f64, g: f64, b: f64) -> void { // No-op placeholderParameters:
x:f64y:f64w:f64h:f64r:f64g:f64b:f64
Returns: void
Defined at line 146
render_circle
Draw a circle.
pub fn render_circle(x: f64, y: f64, radius: f64, r: f64, g: f64, b: f64) -> void { // No-op placeholderParameters:
x:f64y:f64radius:f64r:f64g:f64b:f64
Returns: void
Defined at line 150
render_text
Draw text.
pub fn render_text(x: f64, y: f64, text: str) -> void { // No-op placeholderParameters:
x:f64y:f64text:str
Returns: void
Defined at line 154
render_present
Present the rendered frame to the screen.
pub fn render_present() -> void { // No-op placeholderReturns: void
Defined at line 158
compile_script
Compile a game script. In comptime mode, this generates native code. For now, it’s a no-op (scripts are compiled normally).
pub fn compile_script(source: str) -> void { // In comptime mode, this would generate and compile the script.Parameters:
source:str
Returns: void
Defined at line 181
hot_reload
Reload changed systems. Called when a file changes during development. In production, this is a no-op.
pub fn hot_reload() -> void { // Hot-reload is handled by `fidesc watch` at the compiler level.Returns: void
Defined at line 193
physics_move
Apply velocity to a position over a time step.
pub fn physics_move(pos_x: f64, pos_y: f64, vel_x: f64, vel_y: f64, dt: f64) -> (f64, f64) {Parameters:
pos_x:f64pos_y:f64vel_x:f64vel_y:f64dt:f64
Returns: (f64, f64)
Defined at line 202
physics_gravity
Apply gravity to a velocity.
pub fn physics_gravity(vel_y: f64, gravity: f64, dt: f64) -> f64 {Parameters:
vel_y:f64gravity:f64dt:f64
Returns: f64
Defined at line 209
physics_aabb_overlap
Check if two axis-aligned bounding boxes overlap.
pub fn physics_aabb_overlap(x1: f64, y1: f64, w1: f64, h1: f64, x2: f64, y2: f64, w2: f64, h2: f64) -> bool {Parameters:
x1:f64y1:f64w1:f64h1:f64x2:f64y2:f64w2:f64h2:f64
Returns: bool
Defined at line 214
Generated by scribe, the Fides documentation generator