kagura_engine

Rendering, runtime, platform, asset, audio, and glTF infrastructure for Kagura

moon add mizchi/kagura_engine@0.2.0
Download zip
Author
Version
0.2.0
License
Apache-2.0
Last updated
2 months ago
Downloads
36
README

#
EngineGame

pub(open) trait EngineGame {
fn update_game(Self,
InputSnapshot
) -> Unit
fn draw_game(Self, EngineContext) -> Array[
DrawTrianglesCommand
]
}

High-level game contract for examples and small apps that already model their state as update + draw.

#
EngineContext

pub(all) struct EngineContext {
dst :
ImageHandle

shader :
ShaderHandle

screen_w : Int
screen_h : Int
}

#
FrameProfile

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
)

Frame profiler data for lightweight in-game overlays.

#
LifecycleHooks

pub(all) struct LifecycleHooks {
on_start : (String, String) -> Unit
on_stop : () -> Unit
}

#
build_profiler_hud

fn build_profiler_hud(cmds : Array[
DrawTrianglesCommand
], dst :
ImageHandle
, shader :
ShaderHandle
, profile : FrameProfile, screen_w : Double, screen_h : Double) -> Unit

#
default_frame_profile

fn default_frame_profile() -> FrameProfile

#
render_commands

fn[T :
GraphicsDriver
] render_commands(graphics : T, cmds : Array[
DrawTrianglesCommand
], clear_color? :
Color
, clear_enabled? : Bool) -> Unit raise

#
reset_lifecycle_hooks

fn reset_lifecycle_hooks() -> Unit

#
run

fn 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) -> Unit

#
run_game

fn[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) -> Unit

#
set_lifecycle_hooks

fn set_lifecycle_hooks(hooks : LifecycleHooks) -> Unit

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io