forked from AbleOS/ableos
53 lines
877 B
Plaintext
53 lines
877 B
Plaintext
|
sunset := @use("../../../libraries/sunset_proto/src/lib.hb")
|
||
|
render := @use("../../../libraries/render/src/lib.hb")
|
||
|
|
||
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
||
|
.{log} := stn;
|
||
|
.{Vec2} := stn.math
|
||
|
|
||
|
Player := struct {
|
||
|
x: i8,
|
||
|
y: i8,
|
||
|
|
||
|
$new := fn(x: i8, y: i8): Self {
|
||
|
return Self.(x, y)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
GameState := struct {
|
||
|
player: Player,
|
||
|
|
||
|
$new := fn(): Self {
|
||
|
p := Player.new(0, 0)
|
||
|
return Self.(p)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
main := fn(): void {
|
||
|
sunset.client.find_server()
|
||
|
|
||
|
window := sunset.client.new(.(.(600, 400), .(200, 200), "SDoom\0"))
|
||
|
|
||
|
if window == null {
|
||
|
log.error("got no window\0")
|
||
|
return
|
||
|
}
|
||
|
|
||
|
game_state := GameState.new()
|
||
|
|
||
|
loop {
|
||
|
render.clear(window.surface, render.black)
|
||
|
width := 100
|
||
|
idx := 1
|
||
|
|
||
|
loop {
|
||
|
if idx >= width {
|
||
|
break
|
||
|
}
|
||
|
render.put_vline(window.surface, idx, 10, 100, render.white)
|
||
|
idx += 1
|
||
|
}
|
||
|
|
||
|
_ = sunset.client.send_frame(window)
|
||
|
}
|
||
|
}
|