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

46 lines
1.6 KiB
Plaintext
Raw Normal View History

2024-12-01 15:31:39 -06:00
.{log} := @use("../../../libraries/stn/src/lib.hb")
sunset := @use("../../../libraries/sunset_proto/src/lib.hb")
render := @use("../../../libraries/render/src/lib.hb")
stn := @use("../../../libraries/stn/src/lib.hb");
.{Vec2} := stn.math
psf := @embed("../../../assets/consolefonts/tamsyn/10x20r.psf")
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb");
.{set_color, render_label_to_surface, Label} := horizon_api.widgets.label
main := fn(): void {
sunset.client.find_server()
window := sunset.client.new(.(.(400, 100), .(400, 300), "ableFetch!\0"))
font := @unwrap(render.text.font_from_psf2(@bitcast(&psf), false))
// pos := Vec2(uint).(1, 100)
if window == null {
log.error("got no window\0")
return
}
text_label := Label.new_label("kernel : akern 0.2.0\0", 300)
2024-12-14 10:39:45 -06:00
text_label.set_color(sunset.server.DECO_COLOUR, render.BLACK)
2024-12-01 15:31:39 -06:00
text_label_2 := Label.new_label("os : ableos\0", 300)
2024-12-14 10:39:45 -06:00
text_label_2.set_color(sunset.server.DECO_COLOUR, render.BLACK)
2024-12-01 15:31:39 -06:00
text_label_3 := Label.new_label("wm : sunset\0", 300)
2024-12-14 10:39:45 -06:00
text_label_3.set_color(sunset.server.DECO_COLOUR, render.BLACK)
2024-12-01 15:31:39 -06:00
loop {
2024-12-14 10:39:45 -06:00
render.clear(window.surface, render.BLACK)
2024-12-01 15:31:39 -06:00
// render.put_surface(window.surface, image, .(image.width + x % window.data.props.dimensions.x, 40), false)
pos := Vec2(uint).(1, 100)
render_label_to_surface(window.surface, text_label, font, pos)
pos = Vec2(uint).(1, 120)
render_label_to_surface(window.surface, text_label_2, font, pos)
pos = Vec2(uint).(1, 140)
render_label_to_surface(window.surface, text_label_3, font, pos)
_ = sunset.client.send_frame(window)
}
}