An opinionated binding for WASM-4, a retro game framework using WebAssembly
moon build --source-dir example/snake --target wasm
npx wasm4 run example/snake/target/wasm/release/build/snake.wasmpub struct ADSR {
sustain : UInt
release : UInt
decay : UInt
attack : UInt
}pub struct ADSRVolume {
sustain : UInt
peak : UInt
}pub(all) struct BlitFlag {
one_bit_per_pixel : Bool
flip_x : Bool
flip_y : Bool
rotate : Bool
}pub struct GamePad {
button_1 : Bool
button_2 : Bool
button_left : Bool
button_right : Bool
button_up : Bool
button_down : Bool
}pub struct Mouse {
x : Int
y : Int
left : Bool
middle : Bool
right : Bool
}pub struct Netplay {
index : UInt
active : Bool
}pub struct Note {
note : UInt
bend : UInt
}type Spritefn disk_read(bytes : FixedArray[Byte], size : UInt) -> Intfn disk_write(bytes : FixedArray[Byte], size : UInt) -> Intfn get_draw_colors(index : UInt) -> UIntfn get_frame_buffer(index : UInt) -> UIntfn hline(x : Int, y : Int, len : Int) -> Unitfn line(x1 : Int, y1 : Int, x2 : Int, y2 : Int) -> Unitfn oval(x : Int, y : Int, width : Int, height : Int) -> Unitfn rect(x : Int, y : Int, width : Int, height : Int) -> Unitfn set_draw_colors(palette : UInt, index? : UInt) -> Unitfn set_frame_buffer(index : UInt, palette : UInt) -> Unitfn text(s : String, x : Int, y : Int) -> Unitfn tone_note_mode(frequency : (Note, Note?), duration : ADSR, volume : ADSRVolume, flags : ToneFlag) -> Unitfn vline(x : Int, y : Int, len : Int) -> UnitAn opinionated binding for WASM-4, a retro game framework using WebAssembly