native_runtime_hooks

    Native platform integration for Kagura: windowing, WebGPU, audio, capture and host services

    Download zip
    Author
    Version
    0.6.0
    License
    Apache-2.0
    Last updated
    15 days ago
    Downloads
    16

    #Native platform integration

    トップレベルの platform_native/ に配置した native host の統合 module です。 既存の import 名は mizchi/native_runtime_hooks を使用します。

    platform/ の DesktopNativeHooks に従ってウィンドウ・入力を接続し、 wgpu-native、音声、フォントの hook も起動時に結線します。 PlatformDriver や入力の共通型は mizchi/kagura_platform が所有します。

    ルートと各 example/editor の moon.work から参照します。この module の moon.work でも依存をローカル解決できます。native の prebuild は ../scripts/moon-prebuild-native-link-flags.cjs を使用します。

    gfx_wgpu_native/ は GPU・GLFW・音声 FFI と backend state を所有します。 capture/ は engine のキャプチャデータをファイルへ出力する native adapter です。 両方ともこの module の prebuild を共有し、engine からは import しません。

    services/ は GPU 初期化不要の時計・ファイル I/O。native の起動 hook と Web hook の native 互換経路が、ゲーム状態の構築前に登録します。fetch/ は注入したファイル読み取りを使う取得実装です。

    clear_source_image_palettes

    fn clear_source_image_palettes() -> Unit

    get_engine_context

    fn get_engine_context(width : Int, height : Int) ->
    EngineContext

    Get an EngineContext for building draw commands in headless mode. Must be called after initialize_headless_context().

    initialize_context

    fn initialize_context(width : Int, height : Int, title : String) -> Bool

    initialize_headless_context

    fn initialize_headless_context(width : Int, height : Int) -> Bool

    Initialize a headless context (hidden window) for offscreen rendering.

    install

    fn install(title : String) -> Unit

    is_ready

    fn is_ready() -> Bool

    patch_source_image_rgba8

    fn patch_source_image_rgba8(source_image_id : Int, width : Int, height : Int, dirty_x : Int, dirty_y : Int, dirty_width : Int, dirty_height : Int, rgba8_channels : Array[Int]) -> Bool

    poll_events

    fn poll_events() -> Unit

    register_source_image_palette

    fn register_source_image_palette(source_image_id : Int, palette :
    ImagePalette2x2
    ) -> Unit

    register_source_image_rgba8

    fn register_source_image_rgba8(source_image_id : Int, width : Int, height : Int, rgba8_channels : Array[Int]) -> Unit

    register_source_image_solid_color

    fn register_source_image_solid_color(source_image_id : Int, color :
    Rgba
    ) -> Unit

    render_frame

    fn render_frame() -> Bool

    render_frame_from_commands

    fn render_frame_from_commands(cmds : Array[
    DrawTrianglesCommand
    ], clear_r : Double, clear_g : Double, clear_b : Double, clear_a : Double) -> Bool

    Render a single frame from draw commands and present. Records commands into the planned pipeline and renders using the TriangleContext directly (bypasses runtime_present_planned_frame which can fail with headless surface size queries).

    should_close

    fn should_close() -> Bool

    shutdown

    fn shutdown() -> Unit

    shutdown_context

    fn shutdown_context() -> Unit

    sync_dirty_atlas_pages_from_repository

    fn sync_dirty_atlas_pages_from_repository(repository :
    SimpleAtlasImageRepository
    ) -> Int

    sync_dirty_source_images_from_repository

    fn sync_dirty_source_images_from_repository(repository :
    SimpleImageRepository
    ) -> Int

    sync_source_image_palettes

    fn sync_source_image_palettes(bindings : Array[
    ImagePaletteBinding
    ]) -> Int

    sync_source_image_palettes_from_repository

    fn sync_source_image_palettes_from_repository(repository :
    SimpleImageRepository
    ) -> Int

    sync_source_images

    fn sync_source_images(bindings : Array[
    SourceImageBinding
    ]) -> Int

    sync_source_images_from_repository

    fn sync_source_images_from_repository(repository :
    SimpleImageRepository
    ) -> Int

    uninstall

    fn uninstall() -> Unit