feat(gfx): integrate wasi-gfx for loading and presenting GUI
CI / test (push) Successful in 24s

This commit is contained in:
Antigravity committed 2026-11-25 02:54:03 +00:00
1 parent ccb809bdc3
commit 7caadb3f7f
59 files changed
+7495 -16

No files matched your search

@@ -0,0 +1,38 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
fn wasmImportResourceDropBuffer(resource : Int) = "wasi-gfx:frame-buffer/frame-buffer@0.2.0" "[resource-drop]buffer"
///|
fn wasmImportMethodBufferGetWithCopy(p0 : Int, p1 : Int) = "wasi-gfx:frame-buffer/frame-buffer@0.2.0" "[method]buffer.get-with-copy"
///|
fn wasmImportMethodBufferSetWithCopy(p0 : Int, p1 : Int, p2 : Int) = "wasi-gfx:frame-buffer/frame-buffer@0.2.0" "[method]buffer.set-with-copy"
///|
extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] =
#|(func (param i32) (param i32) (result i32)
#| local.get 0
#| local.get 1 call $moonbit.init_array8
#| local.get 0)
///|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#|(func (param i32) (result i32) (local i32)
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
#| local.tee 1 i32.const 0 call $moonbit.init_array8
#| local.get 1)
///|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
#|(func (param i32) (result i32) local.get 0 i32.load)
///|
extern "wasm" fn mbt_ffi_free(position : Int) =
#|(func (param i32) local.get 0 call $moonbit.decref)
///|
#owned(bytes)
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
#|(func (param i32) (result i32) local.get 0)
@@ -0,0 +1 @@
warnings = "-44"
@@ -0,0 +1,16 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/interface/wasi-gfx/frame-buffer/frame-buffer"
// Values
// Errors
// Types and methods
pub(all) struct Buffer(Int32)
pub fn Buffer::drop(Self) -> Unit
pub fn Buffer::get_with_copy(Self) -> FixedArray[Byte]
pub fn Buffer::set_with_copy(Self, FixedArray[Byte]) -> Unit
// Type aliases
// Traits
@@ -0,0 +1,36 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
pub(all) struct Buffer(Int) derive()
///|
/// Drops a resource handle.
pub fn Buffer::drop(self : Buffer) -> Unit {
let Buffer(resource) = self
wasmImportResourceDropBuffer(resource)
}
///|
/// TODO: This should be replaced with something that doesn't require a copy.
pub fn Buffer::get_with_copy(self : Buffer) -> FixedArray[Byte] {
let Buffer(handle) = self
let return_area = mbt_ffi_malloc(8)
wasmImportMethodBufferGetWithCopy(handle, return_area);
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
let ret = result
mbt_ffi_free(return_area)
return ret
}
///|
pub fn Buffer::set_with_copy(self : Buffer, val : FixedArray[Byte]) -> Unit {
let Buffer(handle) = self
let ptr = mbt_ffi_bytes2ptr(val)
wasmImportMethodBufferSetWithCopy(handle, ptr, val.length());
mbt_ffi_free(ptr)
}
@@ -0,0 +1,14 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
fn wasmImportResourceDropContext(resource : Int) = "wasi-gfx:surface/surface-frame-buffer@0.2.0" "[resource-drop]context"
///|
fn wasmImportConstructorContext(p0 : Int) -> Int = "wasi-gfx:surface/surface-frame-buffer@0.2.0" "[constructor]context"
///|
fn wasmImportMethodContextGetCurrentBuffer(p0 : Int) -> Int = "wasi-gfx:surface/surface-frame-buffer@0.2.0" "[method]context.get-current-buffer"
///|
fn wasmImportMethodContextPresent(p0 : Int) = "wasi-gfx:surface/surface-frame-buffer@0.2.0" "[method]context.present"
@@ -0,0 +1,6 @@
import {
"moonplasma/desktop/interface/wasi-gfx/frame-buffer/frame-buffer" @frame-buffer,
"moonplasma/desktop/interface/wasi-gfx/surface/surface" @surface,
}
warnings = "-44"
@@ -0,0 +1,22 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/interface/wasi-gfx/surface/surface-frame-buffer"
import {
"moonplasma/desktop/interface/wasi-gfx/frame-buffer/frame-buffer",
"moonplasma/desktop/interface/wasi-gfx/surface/surface",
}
// Values
// Errors
// Types and methods
pub(all) struct Context(Int32)
pub fn Context::context(@surface.Surface) -> Self
pub fn Context::drop(Self) -> Unit
pub fn Context::get_current_buffer(Self) -> @frame-buffer.Buffer
pub fn Context::present(Self) -> Unit
// Type aliases
// Traits
@@ -0,0 +1,37 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
pub(all) struct Context(Int) derive()
///|
/// Drops a resource handle.
pub fn Context::drop(self : Context) -> Unit {
let Context(resource) = self
wasmImportResourceDropContext(resource)
}
///|
pub fn Context::context(surface : @surface.Surface) -> Context {
let @surface.Surface(handle) = surface
let result : Int = wasmImportConstructorContext(handle);
let ret = Context::Context(result)
return ret
}
///|
pub fn Context::get_current_buffer(self : Context) -> @frame-buffer.Buffer {
let Context(handle) = self
let result : Int = wasmImportMethodContextGetCurrentBuffer(handle);
let ret = @frame-buffer.Buffer::Buffer(result)
return ret
}
///|
/// TODO: consider if needed
pub fn Context::present(self : Context) -> Unit {
let Context(handle) = self
wasmImportMethodContextPresent(handle);
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,6 @@
import {
"moonplasma/desktop/async-core" @async-core,
}
warnings = "-44"
supported_targets = "wasm"
@@ -0,0 +1,233 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/interface/wasi-gfx/surface/surface"
import {
"moonplasma/desktop/async-core",
}
// Values
// Errors
// Types and methods
pub(all) struct CreateDesc {
height : UInt32?
width : UInt32?
}
pub(all) struct FrameEvent {
nothing : Bool
}
pub(all) enum Key {
BACKQUOTE
BACKSLASH
BRACKET_LEFT
BRACKET_RIGHT
COMMA
DIGIT0
DIGIT1
DIGIT2
DIGIT3
DIGIT4
DIGIT5
DIGIT6
DIGIT7
DIGIT8
DIGIT9
EQUAL
INTL_BACKSLASH
INTL_RO
INTL_YEN
KEY_A
KEY_B
KEY_C
KEY_D
KEY_E
KEY_F
KEY_G
KEY_H
KEY_I
KEY_J
KEY_K
KEY_L
KEY_M
KEY_N
KEY_O
KEY_P
KEY_Q
KEY_R
KEY_S
KEY_T
KEY_U
KEY_V
KEY_W
KEY_X
KEY_Y
KEY_Z
MINUS
PERIOD
QUOTE
SEMICOLON
SLASH
ALT_LEFT
ALT_RIGHT
BACKSPACE
CAPS_LOCK
CONTEXT_MENU
CONTROL_LEFT
CONTROL_RIGHT
ENTER
META_LEFT
META_RIGHT
SHIFT_LEFT
SHIFT_RIGHT
SPACE
TAB
CONVERT
KANA_MODE
LANG1
LANG2
LANG3
LANG4
LANG5
NON_CONVERT
DELETE
END
HELP
HOME
INSERT
PAGE_DOWN
PAGE_UP
ARROW_DOWN
ARROW_LEFT
ARROW_RIGHT
ARROW_UP
NUM_LOCK
NUMPAD0
NUMPAD1
NUMPAD2
NUMPAD3
NUMPAD4
NUMPAD5
NUMPAD6
NUMPAD7
NUMPAD8
NUMPAD9
NUMPAD_ADD
NUMPAD_BACKSPACE
NUMPAD_CLEAR
NUMPAD_CLEAR_ENTRY
NUMPAD_COMMA
NUMPAD_DECIMAL
NUMPAD_DIVIDE
NUMPAD_ENTER
NUMPAD_EQUAL
NUMPAD_HASH
NUMPAD_MEMORY_ADD
NUMPAD_MEMORY_CLEAR
NUMPAD_MEMORY_RECALL
NUMPAD_MEMORY_STORE
NUMPAD_MEMORY_SUBTRACT
NUMPAD_MULTIPLY
NUMPAD_PAREN_LEFT
NUMPAD_PAREN_RIGHT
NUMPAD_STAR
NUMPAD_SUBTRACT
ESCAPE
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
FN
FN_LOCK
PRINT_SCREEN
SCROLL_LOCK
PAUSE
BROWSER_BACK
BROWSER_FAVORITES
BROWSER_FORWARD
BROWSER_HOME
BROWSER_REFRESH
BROWSER_SEARCH
BROWSER_STOP
EJECT
LAUNCH_APP1
LAUNCH_APP2
LAUNCH_MAIL
MEDIA_PLAY_PAUSE
MEDIA_SELECT
MEDIA_STOP
MEDIA_TRACK_NEXT
MEDIA_TRACK_PREVIOUS
POWER
SLEEP
AUDIO_VOLUME_DOWN
AUDIO_VOLUME_MUTE
AUDIO_VOLUME_UP
WAKE_UP
HYPER
SUPER
TURBO
ABORT
RESUME
SUSPEND
AGAIN
COPY
CUT
FIND
OPEN
PASTE
PROPS
SELECT
UNDO
HIRAGANA
KATAKANA
}
pub fn Key::from(Int32) -> Self
pub fn Key::ordinal(Self) -> Int32
pub(all) struct KeyEvent {
key : Key?
text : String?
alt_key : Bool
ctrl_key : Bool
meta_key : Bool
shift_key : Bool
}
pub(all) struct PointerEvent {
x : Double
y : Double
}
pub(all) struct ResizeEvent {
height : UInt32
width : UInt32
}
pub(all) struct Surface(Int32)
pub fn Surface::drop(Self) -> Unit
pub fn Surface::height(Self) -> UInt32
pub fn Surface::on_frame(Self) -> @async-core.Stream[FrameEvent]
pub fn Surface::on_key_down(Self) -> @async-core.Stream[KeyEvent]
pub fn Surface::on_key_up(Self) -> @async-core.Stream[KeyEvent]
pub fn Surface::on_pointer_down(Self) -> @async-core.Stream[PointerEvent]
pub fn Surface::on_pointer_move(Self) -> @async-core.Stream[PointerEvent]
pub fn Surface::on_pointer_up(Self) -> @async-core.Stream[PointerEvent]
pub fn Surface::on_resize(Self) -> @async-core.Stream[ResizeEvent]
pub fn Surface::request_set_size(Self, UInt32?, UInt32?) -> Unit
pub fn Surface::surface(CreateDesc) -> Self
pub fn Surface::width(Self) -> UInt32
// Type aliases
// Traits
+545
View File
@@ -0,0 +1,545 @@
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
pub(all) struct CreateDesc {
height : UInt?; width : UInt?
}
///|
pub(all) struct Surface(Int) derive()
///|
/// Drops a resource handle.
pub fn Surface::drop(self : Surface) -> Unit {
let Surface(resource) = self
wasmImportResourceDropSurface(resource)
}
///|
pub(all) struct ResizeEvent {
height : UInt; width : UInt
}
///|
pub(all) struct FrameEvent {
nothing : Bool
}
///|
pub(all) struct PointerEvent {
x : Double; y : Double
}
///|
/// corresponds with https://w3c.github.io/uievents-code/#code-value-tables
/// `Unidentified` is not included, use `option<key>` instead.
pub(all) enum Key {
BACKQUOTE; BACKSLASH; BRACKET_LEFT; BRACKET_RIGHT; COMMA; DIGIT0; DIGIT1; DIGIT2; DIGIT3; DIGIT4; DIGIT5; DIGIT6; DIGIT7; DIGIT8; DIGIT9; EQUAL; INTL_BACKSLASH; INTL_RO; INTL_YEN; KEY_A; KEY_B; KEY_C; KEY_D; KEY_E; KEY_F; KEY_G; KEY_H; KEY_I; KEY_J; KEY_K; KEY_L; KEY_M; KEY_N; KEY_O; KEY_P; KEY_Q; KEY_R; KEY_S; KEY_T; KEY_U; KEY_V; KEY_W; KEY_X; KEY_Y; KEY_Z; MINUS; PERIOD; QUOTE; SEMICOLON; SLASH; ALT_LEFT; ALT_RIGHT; BACKSPACE; CAPS_LOCK; CONTEXT_MENU; CONTROL_LEFT; CONTROL_RIGHT; ENTER; META_LEFT; META_RIGHT; SHIFT_LEFT; SHIFT_RIGHT; SPACE; TAB; CONVERT; KANA_MODE; LANG1; LANG2; LANG3; LANG4; LANG5; NON_CONVERT; DELETE; END; HELP; HOME; INSERT; PAGE_DOWN; PAGE_UP; ARROW_DOWN; ARROW_LEFT; ARROW_RIGHT; ARROW_UP; NUM_LOCK; NUMPAD0; NUMPAD1; NUMPAD2; NUMPAD3; NUMPAD4; NUMPAD5; NUMPAD6; NUMPAD7; NUMPAD8; NUMPAD9; NUMPAD_ADD; NUMPAD_BACKSPACE; NUMPAD_CLEAR; NUMPAD_CLEAR_ENTRY; NUMPAD_COMMA; NUMPAD_DECIMAL; NUMPAD_DIVIDE; NUMPAD_ENTER; NUMPAD_EQUAL; NUMPAD_HASH; NUMPAD_MEMORY_ADD; NUMPAD_MEMORY_CLEAR; NUMPAD_MEMORY_RECALL; NUMPAD_MEMORY_STORE; NUMPAD_MEMORY_SUBTRACT; NUMPAD_MULTIPLY; NUMPAD_PAREN_LEFT; NUMPAD_PAREN_RIGHT; NUMPAD_STAR; NUMPAD_SUBTRACT; ESCAPE; F1; F2; F3; F4; F5; F6; F7; F8; F9; F10; F11; F12; FN; FN_LOCK; PRINT_SCREEN; SCROLL_LOCK; PAUSE; BROWSER_BACK; BROWSER_FAVORITES; BROWSER_FORWARD; BROWSER_HOME; BROWSER_REFRESH; BROWSER_SEARCH; BROWSER_STOP; EJECT; LAUNCH_APP1; LAUNCH_APP2; LAUNCH_MAIL; MEDIA_PLAY_PAUSE; MEDIA_SELECT; MEDIA_STOP; MEDIA_TRACK_NEXT; MEDIA_TRACK_PREVIOUS; POWER; SLEEP; AUDIO_VOLUME_DOWN; AUDIO_VOLUME_MUTE; AUDIO_VOLUME_UP; WAKE_UP; HYPER; SUPER; TURBO; ABORT; RESUME; SUSPEND; AGAIN; COPY; CUT; FIND; OPEN; PASTE; PROPS; SELECT; UNDO; HIRAGANA; KATAKANA
} derive()
///|
pub fn Key::ordinal(self : Key) -> Int {
match self {
BACKQUOTE => 0
BACKSLASH => 1
BRACKET_LEFT => 2
BRACKET_RIGHT => 3
COMMA => 4
DIGIT0 => 5
DIGIT1 => 6
DIGIT2 => 7
DIGIT3 => 8
DIGIT4 => 9
DIGIT5 => 10
DIGIT6 => 11
DIGIT7 => 12
DIGIT8 => 13
DIGIT9 => 14
EQUAL => 15
INTL_BACKSLASH => 16
INTL_RO => 17
INTL_YEN => 18
KEY_A => 19
KEY_B => 20
KEY_C => 21
KEY_D => 22
KEY_E => 23
KEY_F => 24
KEY_G => 25
KEY_H => 26
KEY_I => 27
KEY_J => 28
KEY_K => 29
KEY_L => 30
KEY_M => 31
KEY_N => 32
KEY_O => 33
KEY_P => 34
KEY_Q => 35
KEY_R => 36
KEY_S => 37
KEY_T => 38
KEY_U => 39
KEY_V => 40
KEY_W => 41
KEY_X => 42
KEY_Y => 43
KEY_Z => 44
MINUS => 45
PERIOD => 46
QUOTE => 47
SEMICOLON => 48
SLASH => 49
ALT_LEFT => 50
ALT_RIGHT => 51
BACKSPACE => 52
CAPS_LOCK => 53
CONTEXT_MENU => 54
CONTROL_LEFT => 55
CONTROL_RIGHT => 56
ENTER => 57
META_LEFT => 58
META_RIGHT => 59
SHIFT_LEFT => 60
SHIFT_RIGHT => 61
SPACE => 62
TAB => 63
CONVERT => 64
KANA_MODE => 65
LANG1 => 66
LANG2 => 67
LANG3 => 68
LANG4 => 69
LANG5 => 70
NON_CONVERT => 71
DELETE => 72
END => 73
HELP => 74
HOME => 75
INSERT => 76
PAGE_DOWN => 77
PAGE_UP => 78
ARROW_DOWN => 79
ARROW_LEFT => 80
ARROW_RIGHT => 81
ARROW_UP => 82
NUM_LOCK => 83
NUMPAD0 => 84
NUMPAD1 => 85
NUMPAD2 => 86
NUMPAD3 => 87
NUMPAD4 => 88
NUMPAD5 => 89
NUMPAD6 => 90
NUMPAD7 => 91
NUMPAD8 => 92
NUMPAD9 => 93
NUMPAD_ADD => 94
NUMPAD_BACKSPACE => 95
NUMPAD_CLEAR => 96
NUMPAD_CLEAR_ENTRY => 97
NUMPAD_COMMA => 98
NUMPAD_DECIMAL => 99
NUMPAD_DIVIDE => 100
NUMPAD_ENTER => 101
NUMPAD_EQUAL => 102
NUMPAD_HASH => 103
NUMPAD_MEMORY_ADD => 104
NUMPAD_MEMORY_CLEAR => 105
NUMPAD_MEMORY_RECALL => 106
NUMPAD_MEMORY_STORE => 107
NUMPAD_MEMORY_SUBTRACT => 108
NUMPAD_MULTIPLY => 109
NUMPAD_PAREN_LEFT => 110
NUMPAD_PAREN_RIGHT => 111
NUMPAD_STAR => 112
NUMPAD_SUBTRACT => 113
ESCAPE => 114
F1 => 115
F2 => 116
F3 => 117
F4 => 118
F5 => 119
F6 => 120
F7 => 121
F8 => 122
F9 => 123
F10 => 124
F11 => 125
F12 => 126
FN => 127
FN_LOCK => 128
PRINT_SCREEN => 129
SCROLL_LOCK => 130
PAUSE => 131
BROWSER_BACK => 132
BROWSER_FAVORITES => 133
BROWSER_FORWARD => 134
BROWSER_HOME => 135
BROWSER_REFRESH => 136
BROWSER_SEARCH => 137
BROWSER_STOP => 138
EJECT => 139
LAUNCH_APP1 => 140
LAUNCH_APP2 => 141
LAUNCH_MAIL => 142
MEDIA_PLAY_PAUSE => 143
MEDIA_SELECT => 144
MEDIA_STOP => 145
MEDIA_TRACK_NEXT => 146
MEDIA_TRACK_PREVIOUS => 147
POWER => 148
SLEEP => 149
AUDIO_VOLUME_DOWN => 150
AUDIO_VOLUME_MUTE => 151
AUDIO_VOLUME_UP => 152
WAKE_UP => 153
HYPER => 154
SUPER => 155
TURBO => 156
ABORT => 157
RESUME => 158
SUSPEND => 159
AGAIN => 160
COPY => 161
CUT => 162
FIND => 163
OPEN => 164
PASTE => 165
PROPS => 166
SELECT => 167
UNDO => 168
HIRAGANA => 169
KATAKANA => 170
}
}
///|
pub fn Key::from(self : Int) -> Key {
match self {
0 => BACKQUOTE
1 => BACKSLASH
2 => BRACKET_LEFT
3 => BRACKET_RIGHT
4 => COMMA
5 => DIGIT0
6 => DIGIT1
7 => DIGIT2
8 => DIGIT3
9 => DIGIT4
10 => DIGIT5
11 => DIGIT6
12 => DIGIT7
13 => DIGIT8
14 => DIGIT9
15 => EQUAL
16 => INTL_BACKSLASH
17 => INTL_RO
18 => INTL_YEN
19 => KEY_A
20 => KEY_B
21 => KEY_C
22 => KEY_D
23 => KEY_E
24 => KEY_F
25 => KEY_G
26 => KEY_H
27 => KEY_I
28 => KEY_J
29 => KEY_K
30 => KEY_L
31 => KEY_M
32 => KEY_N
33 => KEY_O
34 => KEY_P
35 => KEY_Q
36 => KEY_R
37 => KEY_S
38 => KEY_T
39 => KEY_U
40 => KEY_V
41 => KEY_W
42 => KEY_X
43 => KEY_Y
44 => KEY_Z
45 => MINUS
46 => PERIOD
47 => QUOTE
48 => SEMICOLON
49 => SLASH
50 => ALT_LEFT
51 => ALT_RIGHT
52 => BACKSPACE
53 => CAPS_LOCK
54 => CONTEXT_MENU
55 => CONTROL_LEFT
56 => CONTROL_RIGHT
57 => ENTER
58 => META_LEFT
59 => META_RIGHT
60 => SHIFT_LEFT
61 => SHIFT_RIGHT
62 => SPACE
63 => TAB
64 => CONVERT
65 => KANA_MODE
66 => LANG1
67 => LANG2
68 => LANG3
69 => LANG4
70 => LANG5
71 => NON_CONVERT
72 => DELETE
73 => END
74 => HELP
75 => HOME
76 => INSERT
77 => PAGE_DOWN
78 => PAGE_UP
79 => ARROW_DOWN
80 => ARROW_LEFT
81 => ARROW_RIGHT
82 => ARROW_UP
83 => NUM_LOCK
84 => NUMPAD0
85 => NUMPAD1
86 => NUMPAD2
87 => NUMPAD3
88 => NUMPAD4
89 => NUMPAD5
90 => NUMPAD6
91 => NUMPAD7
92 => NUMPAD8
93 => NUMPAD9
94 => NUMPAD_ADD
95 => NUMPAD_BACKSPACE
96 => NUMPAD_CLEAR
97 => NUMPAD_CLEAR_ENTRY
98 => NUMPAD_COMMA
99 => NUMPAD_DECIMAL
100 => NUMPAD_DIVIDE
101 => NUMPAD_ENTER
102 => NUMPAD_EQUAL
103 => NUMPAD_HASH
104 => NUMPAD_MEMORY_ADD
105 => NUMPAD_MEMORY_CLEAR
106 => NUMPAD_MEMORY_RECALL
107 => NUMPAD_MEMORY_STORE
108 => NUMPAD_MEMORY_SUBTRACT
109 => NUMPAD_MULTIPLY
110 => NUMPAD_PAREN_LEFT
111 => NUMPAD_PAREN_RIGHT
112 => NUMPAD_STAR
113 => NUMPAD_SUBTRACT
114 => ESCAPE
115 => F1
116 => F2
117 => F3
118 => F4
119 => F5
120 => F6
121 => F7
122 => F8
123 => F9
124 => F10
125 => F11
126 => F12
127 => FN
128 => FN_LOCK
129 => PRINT_SCREEN
130 => SCROLL_LOCK
131 => PAUSE
132 => BROWSER_BACK
133 => BROWSER_FAVORITES
134 => BROWSER_FORWARD
135 => BROWSER_HOME
136 => BROWSER_REFRESH
137 => BROWSER_SEARCH
138 => BROWSER_STOP
139 => EJECT
140 => LAUNCH_APP1
141 => LAUNCH_APP2
142 => LAUNCH_MAIL
143 => MEDIA_PLAY_PAUSE
144 => MEDIA_SELECT
145 => MEDIA_STOP
146 => MEDIA_TRACK_NEXT
147 => MEDIA_TRACK_PREVIOUS
148 => POWER
149 => SLEEP
150 => AUDIO_VOLUME_DOWN
151 => AUDIO_VOLUME_MUTE
152 => AUDIO_VOLUME_UP
153 => WAKE_UP
154 => HYPER
155 => SUPER
156 => TURBO
157 => ABORT
158 => RESUME
159 => SUSPEND
160 => AGAIN
161 => COPY
162 => CUT
163 => FIND
164 => OPEN
165 => PASTE
166 => PROPS
167 => SELECT
168 => UNDO
169 => HIRAGANA
170 => KATAKANA
_ => panic()
}
}
///|
pub(all) struct KeyEvent {
key : Key?; text : String?; alt_key : Bool; ctrl_key : Bool; meta_key : Bool; shift_key : Bool
}
///|
pub fn Surface::surface(desc : CreateDesc) -> Surface {
let (lowered, lowered1) = match ((desc).height) {
None => {
((0), 0)
}
Some(payload0) => {
((1), (payload0).reinterpret_as_int())
}
}
let (lowered4, lowered5) = match ((desc).width) {
None => {
((0), 0)
}
Some(payload3) => {
((1), (payload3).reinterpret_as_int())
}
}
let result : Int = wasmImportConstructorSurface(lowered, lowered1, lowered4, lowered5);
let ret = Surface::Surface(result)
return ret
}
///|
pub fn Surface::height(self : Surface) -> UInt {
let Surface(handle) = self
let result : Int = wasmImportMethodSurfaceHeight(handle);
let ret = (result).reinterpret_as_uint()
return ret
}
///|
pub fn Surface::width(self : Surface) -> UInt {
let Surface(handle) = self
let result : Int = wasmImportMethodSurfaceWidth(handle);
let ret = (result).reinterpret_as_uint()
return ret
}
///|
pub fn Surface::request_set_size(self : Surface, height : UInt?, width : UInt?) -> Unit {
let Surface(handle) = self
let (lowered, lowered1) = match (height) {
None => {
((0), 0)
}
Some(payload0) => {
((1), (payload0).reinterpret_as_int())
}
}
let (lowered4, lowered5) = match (width) {
None => {
((0), 0)
}
Some(payload3) => {
((1), (payload3).reinterpret_as_int())
}
}
wasmImportMethodSurfaceRequestSetSize(handle, lowered, lowered1, lowered4, lowered5);
}
///|
pub fn Surface::on_resize(self : Surface) -> @async-core.Stream[ResizeEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnResize(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnResizeStream0StreamLift(result)
let ret = result0
return ret
}
///|
pub fn Surface::on_frame(self : Surface) -> @async-core.Stream[FrameEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnFrame(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnFrameStream0StreamLift(result)
let ret = result0
return ret
}
///|
pub fn Surface::on_pointer_up(self : Surface) -> @async-core.Stream[PointerEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnPointerUp(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnPointerUpStream0StreamLift(result)
let ret = result0
return ret
}
///|
pub fn Surface::on_pointer_down(self : Surface) -> @async-core.Stream[PointerEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnPointerDown(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnPointerDownStream0StreamLift(result)
let ret = result0
return ret
}
///|
pub fn Surface::on_pointer_move(self : Surface) -> @async-core.Stream[PointerEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnPointerMove(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnPointerMoveStream0StreamLift(result)
let ret = result0
return ret
}
///|
pub fn Surface::on_key_up(self : Surface) -> @async-core.Stream[KeyEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnKeyUp(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnKeyUpStream0StreamLift(result)
let ret = result0
return ret
}
///|
pub fn Surface::on_key_down(self : Surface) -> @async-core.Stream[KeyEvent] {
let Surface(handle) = self
let lower_arg = handle
let result : Int = wasmImportMethodSurfaceOnKeyDown(lower_arg);
let result0 = wasmWasiGfxSurfaceSurface020MethodSurfaceOnKeyDownStream0StreamLift(result)
let ret = result0
return ret
}