diff --git a/sysdata/libraries/horizon_api/src/widgets/label.hb b/sysdata/libraries/horizon_api/src/widgets/label.hb index ce7e030a7..3241b5262 100644 --- a/sysdata/libraries/horizon_api/src/widgets/label.hb +++ b/sysdata/libraries/horizon_api/src/widgets/label.hb @@ -15,8 +15,8 @@ Label := struct { bg: Color, fg: Color, - new_label := fn(text: ^u8): Self { - text_surface := render.new_surface(1024, 20) + new_label := fn(text: ^u8, width: uint): Self { + text_surface := render.new_surface(width, 20) text_length := string.length(text) label := Self.(3, true, text_surface, text, text_length, render.black, render.white) return label diff --git a/sysdata/programs/ablefetch/README.md b/sysdata/programs/ablefetch/README.md new file mode 100644 index 000000000..540b13062 --- /dev/null +++ b/sysdata/programs/ablefetch/README.md @@ -0,0 +1 @@ +# ablefetch \ No newline at end of file diff --git a/sysdata/programs/ablefetch/meta.toml b/sysdata/programs/ablefetch/meta.toml new file mode 100644 index 000000000..193c3b0f6 --- /dev/null +++ b/sysdata/programs/ablefetch/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "ablefetch" +authors = [""] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/ablefetch/src/main.hb b/sysdata/programs/ablefetch/src/main.hb new file mode 100644 index 000000000..70107759f --- /dev/null +++ b/sysdata/programs/ablefetch/src/main.hb @@ -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) + } +} \ No newline at end of file diff --git a/sysdata/programs/sunset_server/src/main.hb b/sysdata/programs/sunset_server/src/main.hb index 9f438d741..f837bf520 100644 --- a/sysdata/programs/sunset_server/src/main.hb +++ b/sysdata/programs/sunset_server/src/main.hb @@ -31,7 +31,7 @@ main := fn(): int { mouse_x := 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) loop { diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index d50fab87c..19fcdd567 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -28,8 +28,8 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.horizon] # path = "boot:///horizon.hbf" -# [boot.limine.ableos.modules.ps2_mouse_driver] -# path = "boot:///ps2_mouse_driver.hbf" +[boot.limine.ableos.modules.ps2_mouse_driver] +path = "boot:///ps2_mouse_driver.hbf" # [boot.limine.ableos.modules.ps2_keyboard_driver] # path = "boot:///ps2_keyboard_driver.hbf" @@ -40,8 +40,8 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.sunset_client] # path = "boot:///sunset_client.hbf" -# [boot.limine.ableos.modules.sunset_server] -# path = "boot:///sunset_server.hbf" +[boot.limine.ableos.modules.sunset_server] +path = "boot:///sunset_server.hbf" -[boot.limine.ableos.modules.filesystem_fat32] -path = "boot:///filesystem_fat32.hbf" +[boot.limine.ableos.modules.ablefetch] +path = "boot:///ablefetch.hbf"