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

53 lines
775 B
Plaintext

sunset := @use("lib:sunset_proto")
render := @use("lib:render")
stn := @use("stn");
.{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"))
if window == null {
log.error("got no window")
return
}
game_state := GameState.new()
loop {
window.surface.clear(render.BLACK)
width := 100
idx := 1
loop {
if idx >= width {
break
}
window.surface.put_vline(idx, 10, 100, render.WHITE)
idx += 1
}
_ = sunset.client.send_frame(window)
}
}