implements input on stdlib
This commit is contained in:
+77
@@ -0,0 +1,77 @@
|
||||
[BuiltinType(name = "input", version = 1)]
|
||||
declare builtin type Input() {
|
||||
[IntrinsicCall(name = "pad", version = 1)]
|
||||
fn pad() -> InputPad;
|
||||
|
||||
[IntrinsicCall(name = "touch", version = 1)]
|
||||
fn touch() -> InputTouch;
|
||||
}
|
||||
|
||||
[BuiltinType(name = "input.pad", version = 1)]
|
||||
declare builtin type InputPad() {
|
||||
[IntrinsicCall(name = "up", version = 1)]
|
||||
fn up() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "down", version = 1)]
|
||||
fn down() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "left", version = 1)]
|
||||
fn left() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "right", version = 1)]
|
||||
fn right() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "a", version = 1)]
|
||||
fn a() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "b", version = 1)]
|
||||
fn b() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "x", version = 1)]
|
||||
fn x() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "y", version = 1)]
|
||||
fn y() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "l", version = 1)]
|
||||
fn l() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "r", version = 1)]
|
||||
fn r() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "start", version = 1)]
|
||||
fn start() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "select", version = 1)]
|
||||
fn select() -> InputButton;
|
||||
}
|
||||
|
||||
[BuiltinType(name = "input.touch", version = 1)]
|
||||
declare builtin type InputTouch() {
|
||||
[IntrinsicCall(name = "button", version = 1)]
|
||||
fn button() -> InputButton;
|
||||
|
||||
[IntrinsicCall(name = "x", version = 1)]
|
||||
fn x() -> int;
|
||||
|
||||
[IntrinsicCall(name = "y", version = 1)]
|
||||
fn y() -> int;
|
||||
}
|
||||
|
||||
[BuiltinType(name = "input.button", version = 1)]
|
||||
declare builtin type InputButton() {
|
||||
[IntrinsicCall(name = "pressed", version = 1)]
|
||||
fn pressed() -> bool;
|
||||
|
||||
[IntrinsicCall(name = "released", version = 1)]
|
||||
fn released() -> bool;
|
||||
|
||||
[IntrinsicCall(name = "down", version = 1)]
|
||||
fn down() -> bool;
|
||||
|
||||
[IntrinsicCall(name = "hold", version = 1)]
|
||||
fn hold() -> int;
|
||||
}
|
||||
|
||||
[BuiltinConst(target = "input", name = "global", version = 1)]
|
||||
declare const Input: Input;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
pub struct Input;
|
||||
pub struct InputPad;
|
||||
pub struct InputTouch;
|
||||
pub struct InputButton;
|
||||
pub const Input;
|
||||
Reference in New Issue
Block a user