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

53 lines
775 B
Plaintext
Raw Normal View History

2024-12-22 20:58:28 -06:00
sunset := @use("lib:sunset_proto")
render := @use("lib:render")
2024-11-26 07:39:16 -06:00
2024-12-22 20:58:28 -06:00
stn := @use("stn");
2024-11-26 07:39:16 -06:00
.{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()
2024-12-22 20:58:28 -06:00
window := sunset.client.new(.(.(600, 400), .(200, 200), "SDoom"))
2024-11-26 07:39:16 -06:00
if window == null {
2024-12-22 20:58:28 -06:00
log.error("got no window")
2024-11-26 07:39:16 -06:00
return
}
game_state := GameState.new()
loop {
2024-12-22 20:58:28 -06:00
window.surface.clear(render.BLACK)
2024-11-26 07:39:16 -06:00
width := 100
idx := 1
loop {
if idx >= width {
break
}
2024-12-22 20:58:28 -06:00
window.surface.put_vline(idx, 10, 100, render.WHITE)
2024-11-26 07:39:16 -06:00
idx += 1
}
_ = sunset.client.send_frame(window)
}
}