Rendering, presentation, assets, audio and application runtime for Kagura
Dependencies
pub(open) trait EngineGame {
fn update_game(Self, InputSnapshot) -> Unit
fn draw_game(Self, EngineContext) -> Array[DrawTrianglesCommand]
}pub(all) struct EngineContext {
dst : ImageHandle
shader : ShaderHandle
screen_w : Int
screen_h : Int
}pub(all) struct FrameProfile {
fps : Double
frame_time_ms : Double
update_ms : Double
draw_ms : Double
gpu_frame_ms : Double
draw_calls : Int
vertex_count : Int
asset_inflight : Int
} derive(Debug)impl Show for FrameProfilepub(all) struct HeadlessFrame {
width : Int
height : Int
frames : Int
pixels : Array[Int]
skipped_commands : Int
drawn_triangles : Int
draw_commands : Int
}pub struct InitialStates[T] {
default_factory : (Int, Int) -> T
named : Array[(String, (Int, Int) -> T)]
}fn[T] InitialStates::create(self : InitialStates[T], name : String?, width~ : Int, height~ : Int) -> T raise InitialStateErrorfn[T] InitialStates::new(default~ : (Int, Int) -> T, named? : Array[(String, (Int, Int) -> T)]) -> InitialStates[T] raise InitialStateErrorpub(all) struct LifecycleHooks {
on_start : (String, String) -> Unit
on_stop : () -> Unit
}fn build_profiler_hud(cmds : Array[DrawTrianglesCommand], dst : ImageHandle, shader : ShaderHandle, profile : FrameProfile, screen_w : Double, screen_h : Double) -> Unitfn[T : GraphicsDriver] render_commands(graphics : T, cmds : Array[DrawTrianglesCommand], clear_color? : Color, clear_enabled? : Bool) -> Unit raisefn render_headless_frame(update~ : (InputSnapshot) -> Unit, draw~ : (EngineContext) -> Array[DrawTrianglesCommand], width~ : Int, height~ : Int, frames~ : Int, input? : HeadlessInput, input_at? : (Int) -> InputSnapshot, on_frame? : () -> Unit, textures? : Array[HeadlessTexture], textures_at? : () -> Array[HeadlessTexture], clear_color? : Color) -> HeadlessFramefn run(update~ : (InputSnapshot) -> Unit, draw~ : (EngineContext) -> Array[DrawTrianglesCommand], on_frame? : () -> Unit, after_render? : (Double, Double) -> Unit, audio_ctx? : MixerAudioContext, audio_frames_per_tick? : Int, width? : Int, height? : Int, title? : String, canvas? : String) -> Unitfn[T : EngineGame] run_game(game : T, on_frame? : () -> Unit, after_render? : (Double, Double) -> Unit, audio_ctx? : MixerAudioContext, audio_frames_per_tick? : Int, width? : Int, height? : Int, title? : String, canvas? : String) -> UnitInstall
Download zipRendering, presentation, assets, audio and application runtime for Kagura
Dependencies