Sign in

    selene_webgpu

    Default backend for Selene game engine.

    Game Engine
    Download zip
    Author
    Version
    0.31.1
    License
    Apache-2.0
    Last updated
    6 months ago
    Downloads
    828

    #Milky2018/selene_webgpu

    WebGPU backend implementation for Selene.

    #Install

    moon add Milky2018/selene_webgpu

    #Enable This Backend

    Override Selene platform interfaces in your entry package:

    options(
    overrides: [
    "Milky2018/selene_webgpu/platform_window",
    "Milky2018/selene_webgpu/platform_input",
    "Milky2018/selene_webgpu/platform_render",
    "Milky2018/selene_webgpu/platform_audio",
    "Milky2018/selene_webgpu/platform_asset_io",
    ],
    )

    #Build And Run

    moon build --target js --release python3 -m http.server 8000

    Open http://localhost:8000.

    AudioInstance

    type AudioInstance = Int

    Audio

    type Audio

    Audio::is_ended

    fn Audio::is_ended(self : Audio) -> Bool

    Audio::is_paused

    fn Audio::is_paused(self : Audio) -> Bool

    Audio::new

    fn Audio::new(path : String) -> Audio

    Audio::pause

    fn Audio::pause(self : Audio) -> Unit

    Audio::play

    fn Audio::play(self : Audio) -> Unit

    Audio::set_current_time

    fn Audio::set_current_time(self : Audio, current_time : Double) -> Unit

    Audio::set_loop

    fn Audio::set_loop(self : Audio, loop_ : Bool) -> Unit

    Audio::set_playback_rate

    fn Audio::set_playback_rate(self : Audio, playback_rate : Double) -> Unit

    Audio::set_volume

    fn Audio::set_volume(self : Audio, volume : Double) -> Unit

    WebGpuBackend

    type WebGpuBackend

    WebGpuBackend::new

    begin_frame

    fn begin_frame(clear :
    Color
    ) -> Unit

    draw_gradient_rect

    draw_image

    fn draw_image(command :
    ImageDrawCommand2D
    , image_path : String) -> Unit

    end_frame

    fn end_frame() -> Unit

    get_asset_bytes

    fn get_asset_bytes(path : String) -> Bytes?

    get_realtime_delta

    fn get_realtime_delta() -> Double

    get_time_scale

    fn get_time_scale() -> Double

    is_finished

    fn is_finished(instance~ : Int) -> Bool

    load_font

    fn load_font(font : String, path : String) -> Unit

    lock_mouse

    fn lock_mouse(locked :
    Ref
    [Bool]) -> Unit

    play_audio

    fn play_audio(audio_path~ : String, volume~ : Double, speed~ : Double, loop_~ : Bool, paused~ : Bool) -> Int

    pop_clip_rect

    fn pop_clip_rect() -> Unit

    preload_audio

    fn preload_audio(audio_path : String) -> Unit

    preload_img

    fn preload_img(path : String) -> Unit

    push_clip_rect

    fn push_clip_rect(_rect :
    Rect
    ) -> Unit

    register_key_events

    fn register_key_events(pressed_keys :
    Set
    [
    Code
    ]) -> Unit

    register_mouse_events

    release_image_asset

    fn release_image_asset(handle :
    ImageHandle
    ) -> Unit

    release_material_asset

    fn release_material_asset(handle :
    MaterialHandle
    ) -> Unit

    release_mesh_asset

    fn release_mesh_asset(handle :
    MeshHandle
    ) -> Unit

    render_3d_frame

    request_close

    fn request_close() -> Unit

    reset_clip_stack

    fn reset_clip_stack() -> Unit

    set_embedded_assets

    fn set_embedded_assets(lookup : (String) -> Bytes?) -> Unit

    set_loop

    fn set_loop(instance~ : Int, loop_~ : Bool) -> Unit

    set_paused

    fn set_paused(instance~ : Int, paused~ : Bool) -> Unit

    set_speed

    fn set_speed(instance~ : Int, speed~ : Double) -> Unit

    set_time_scale

    fn set_time_scale(time_scale : Double) -> Unit

    set_volume

    fn set_volume(instance~ : Int, volume~ : Double) -> Unit

    stop

    fn stop(instance~ : Int) -> Unit

    sync_mouse_lock_state

    fn sync_mouse_lock_state(locked : Bool) -> Bool

    tick_audio

    fn tick_audio() -> Unit

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io