forked from AbleOS/ableos
hacky impl of a fetch program
This commit is contained in:
parent
190f0941dc
commit
28258e0d45
|
@ -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
|
||||
|
|
1
sysdata/programs/ablefetch/README.md
Normal file
1
sysdata/programs/ablefetch/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
# ablefetch
|
11
sysdata/programs/ablefetch/meta.toml
Normal file
11
sysdata/programs/ablefetch/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "ablefetch"
|
||||
authors = [""]
|
||||
|
||||
[dependants.libraries]
|
||||
|
||||
[dependants.binaries]
|
||||
hblang.version = "1.0.0"
|
||||
|
||||
[build]
|
||||
command = "hblang src/main.hb"
|
46
sysdata/programs/ablefetch/src/main.hb
Normal file
46
sysdata/programs/ablefetch/src/main.hb
Normal 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)
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue