This commit is contained in:
1 parent
ccb809bdc3
commit
7caadb3f7f
59 files changed
+7495
-16
No files matched your search
@@ -0,0 +1,13 @@
|
||||
package wasi-gfx:frame-buffer@0.2.0;
|
||||
|
||||
world imports {
|
||||
import frame-buffer;
|
||||
}
|
||||
|
||||
interface frame-buffer {
|
||||
resource buffer {
|
||||
// TODO: This should be replaced with something that doesn't require a copy.
|
||||
get-with-copy: func() -> list<u8>;
|
||||
set-with-copy: func(val: list<u8>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
interface surface-frame-buffer {
|
||||
use wasi-gfx:frame-buffer/frame-buffer@0.2.0.{buffer};
|
||||
use surface.{surface};
|
||||
|
||||
resource context {
|
||||
constructor(surface: borrow<surface>);
|
||||
get-current-buffer: func() -> buffer;
|
||||
// TODO: consider if needed
|
||||
present: func();
|
||||
}
|
||||
}
|
||||
|
||||
world frame-buffer-imports {
|
||||
import surface-frame-buffer;
|
||||
import wasi-gfx:frame-buffer/frame-buffer@0.2.0;
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
package wasi-gfx:surface@0.2.0;
|
||||
|
||||
world imports {
|
||||
import surface;
|
||||
}
|
||||
|
||||
interface surface {
|
||||
record create-desc {
|
||||
height: option<u32>,
|
||||
width: option<u32>,
|
||||
}
|
||||
|
||||
resource surface {
|
||||
constructor(desc: create-desc);
|
||||
|
||||
height: func() -> u32;
|
||||
width: func() -> u32;
|
||||
|
||||
request-set-size: func(height: option<u32>, width: option<u32>);
|
||||
|
||||
on-resize: func() -> stream<resize-event>;
|
||||
on-frame: func() -> stream<frame-event>;
|
||||
on-pointer-up: func() -> stream<pointer-event>;
|
||||
on-pointer-down: func() -> stream<pointer-event>;
|
||||
on-pointer-move: func() -> stream<pointer-event>;
|
||||
on-key-up: func() -> stream<key-event>;
|
||||
on-key-down: func() -> stream<key-event>;
|
||||
}
|
||||
|
||||
record resize-event {
|
||||
height: u32,
|
||||
width: u32,
|
||||
}
|
||||
|
||||
record frame-event {
|
||||
/// TODO: This field doesn't mean anything.
|
||||
/// Can't have empty record. Would like to have a way around this.
|
||||
nothing: bool,
|
||||
}
|
||||
|
||||
record pointer-event {
|
||||
x: f64,
|
||||
y: f64,
|
||||
}
|
||||
|
||||
record key-event {
|
||||
key: option<key>,
|
||||
text: option<string>,
|
||||
alt-key: bool,
|
||||
ctrl-key: bool,
|
||||
meta-key: bool,
|
||||
shift-key: bool,
|
||||
}
|
||||
|
||||
// corresponds with https://w3c.github.io/uievents-code/#code-value-tables
|
||||
// `Unidentified` is not included, use `option<key>` instead.
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user