1
0
Fork 0
forked from AbleOS/ableos

hacky impl of a fetch program

This commit is contained in:
Able 2024-12-01 15:31:39 -06:00
parent 190f0941dc
commit 28258e0d45
6 changed files with 67 additions and 9 deletions

View file

@ -15,8 +15,8 @@ Label := struct {
bg: Color, bg: Color,
fg: Color, fg: Color,
new_label := fn(text: ^u8): Self { new_label := fn(text: ^u8, width: uint): Self {
text_surface := render.new_surface(1024, 20) text_surface := render.new_surface(width, 20)
text_length := string.length(text) text_length := string.length(text)
label := Self.(3, true, text_surface, text, text_length, render.black, render.white) label := Self.(3, true, text_surface, text, text_length, render.black, render.white)
return label return label

View file

@ -0,0 +1 @@
# ablefetch

View file

@ -0,0 +1,11 @@
[package]
name = "ablefetch"
authors = [""]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build]
command = "hblang src/main.hb"

View file

@ -0,0 +1,46 @@
.{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)
text_label.set_color(sunset.server.DECO_COLOUR, render.black)
text_label_2 := Label.new_label("os : ableos\0", 300)
text_label_2.set_color(sunset.server.DECO_COLOUR, render.black)
text_label_3 := Label.new_label("wm : sunset\0", 300)
text_label_3.set_color(sunset.server.DECO_COLOUR, render.black)
loop {
render.clear(window.surface, render.black)
// 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)
}
}

View file

@ -31,7 +31,7 @@ main := fn(): int {
mouse_x := 100 mouse_x := 100
mouse_y := 100 mouse_y := 100
text_label := Label.new_label("Hi\0") text_label := Label.new_label("Hi\0", 1024)
text_label.set_color(sunset.server.DECO_COLOUR, render.black) text_label.set_color(sunset.server.DECO_COLOUR, render.black)
loop { loop {

View file

@ -28,8 +28,8 @@ resolution = "1024x768x24"
# [boot.limine.ableos.modules.horizon] # [boot.limine.ableos.modules.horizon]
# path = "boot:///horizon.hbf" # path = "boot:///horizon.hbf"
# [boot.limine.ableos.modules.ps2_mouse_driver] [boot.limine.ableos.modules.ps2_mouse_driver]
# path = "boot:///ps2_mouse_driver.hbf" path = "boot:///ps2_mouse_driver.hbf"
# [boot.limine.ableos.modules.ps2_keyboard_driver] # [boot.limine.ableos.modules.ps2_keyboard_driver]
# path = "boot:///ps2_keyboard_driver.hbf" # path = "boot:///ps2_keyboard_driver.hbf"
@ -40,8 +40,8 @@ resolution = "1024x768x24"
# [boot.limine.ableos.modules.sunset_client] # [boot.limine.ableos.modules.sunset_client]
# path = "boot:///sunset_client.hbf" # path = "boot:///sunset_client.hbf"
# [boot.limine.ableos.modules.sunset_server] [boot.limine.ableos.modules.sunset_server]
# path = "boot:///sunset_server.hbf" path = "boot:///sunset_server.hbf"
[boot.limine.ableos.modules.filesystem_fat32] [boot.limine.ableos.modules.ablefetch]
path = "boot:///filesystem_fat32.hbf" path = "boot:///ablefetch.hbf"