Kagura runtime hooks for browser JavaScript and WebAssembly, with native integration
let pointer = @hooks.WebPointerInput::new(selector="#app")
// CSS上のCanvasサイズからゲームの論理座標へ変換する。
let frame = pointer.poll(width=game_width, height=game_height)
// Some(frame)ならUIModalLayer.handle_pointerやUIDragController.handle_pointerへ。
// Canvasのないヘッドレス実行ではNoneなのでInputSnapshotにフォールバックできる。
pointer.dispose()pub struct WebPointerInput {
// private fields
}fn WebPointerInput::poll(self : WebPointerInput, width~ : Double, height~ : Double) -> UIPointerFrame?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]) -> Boolfn register_source_image_rgba8(source_image_id : Int, width : Int, height : Int, rgba8_channels : Array[Int]) -> Unitfn source_image_pixel_channel(image_id : Int, x : Int, y : Int, channel_index : Int) -> IntInstall
Download zipKagura runtime hooks for browser JavaScript and WebAssembly, with native integration