ableos/sysdata/programs/tetris/src/main.hb

28 lines
891 B
Plaintext
Raw Normal View History

.{memory, log, string, buffer, math} := @use("../../../libraries/stn/src/lib.hb")
render := @use("../../../libraries/render/src/lib.hb")
Color := render.Color
Vec2 := math.Vec2
main := fn(): void {
input := @as(u8, 0)
output_buffer := memory.request_page(1)
input_buffer := buffer.search("XKeyboard\0")
render.init()
loop {
render.clear(render.black)
render.put_vline(100, 255, 128, Color.(255, 255, 255, 255))
render.put_hline(64, 100 - 64, 164, Color.(255, 255, 255, 255))
render.put_trirect(Vec2(int).(128, 128 + 256), Vec2(int).(256, -256), Color.(147, 147, 147, 255), Color.(107, 107, 107, 255))
render.put_filled_rect(Vec2(int).(128 + 32, 128 + 32), Vec2(int).(256 - 64, 256 - 64), Color.(127, 127, 127, 127))
render.sync()
buffer.recv(input_buffer, &input, 1)
if input != 0 {
log.info(string.display_int(input, output_buffer))
input = 0
}
}
return
}