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

30 lines
812 B
Plaintext
Raw Normal View History

.{log} := @use("../../../libraries/stn/src/lib.hb")
2024-11-10 12:57:48 -06:00
sunset := @use("../../../libraries/sunset_proto/src/lib.hb")
render := @use("../../../libraries/render/src/lib.hb")
2024-11-10 12:57:48 -06:00
bmp := @embed("../../../assets/mini.bmp")
2024-11-10 12:57:48 -06:00
main := fn(): void {
sunset.client.find_server()
image := render.image.from(@bitcast(&bmp))
if image == null {
log.error("got no image\0")
return
}
window := sunset.client.new(.(.(100, 100), .(480, 200), "sunset windowing demo paddingpaddingpadding\0"))
2024-11-13 11:03:31 -06:00
if window == null {
log.error("got no window\0")
2024-11-10 12:57:48 -06:00
return
}
x := 0
loop {
render.clear(window.surface, render.cyan)
render.put_surface(window.surface, image, .(image.width + x % window.data.props.dimensions.x, 20), false)
if sunset.client.send_frame(window) == false {
log.error("did not send frame\0")
}
x += 1
}
2024-11-10 12:57:48 -06:00
}