add support for game input

This commit is contained in:
2021-11-28 22:47:23 +01:00
parent 667a222331
commit 8695a222f0
8 changed files with 156 additions and 13 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -2,12 +2,16 @@ import "env.memory" memory(4);
import "env.cos" fn cos(f32) -> f32;
export fn time() -> i32 {
0!64
export fn time() -> f32 {
(0!64) as f32 / 1000 as f32
}
export fn ftime() -> f32 {
(0!64) as f32 / 1000 as f32
export fn isButtonPressed(btn: i32) -> i32 {
(68!0 >> btn) & 1
}
export fn isButtonTriggered(btn: i32) -> i32 {
((68!0 & (-1 - 68!4)) >> btn) & 1
}
global mut randomState: i64 = 37i64;
@@ -117,6 +121,10 @@ export fn circle(cx: f32, cy: f32, radius: f32, col: i32) {
}
}
export fn endFrame() {
68!4 = 68!0;
}
start fn setup() {
let i: i32 = 12*16*3-1;
let avg: f32;