Compare commits

..

2 commits

Author SHA1 Message Date
Able 8849017db2 Merge branch 'master' of ssh://git.ablecorp.us:20/AbleOS/ableos 2024-12-16 08:01:46 -06:00
Able f3b78d1699 local changes 👍 2024-12-16 07:58:04 -06:00
12 changed files with 125 additions and 49 deletions

View file

@ -38,9 +38,9 @@ Label := struct {
}
render_label_to_surface := fn(surface: Surface, label: Label, font: Font, pos: Vec2(uint)): void {
if label.is_dirty {
label.surface.clear(label.bg)
label.surface.put_text(font, .(0, 0), label.fg, label.text)
}
surface.put_surface(label.surface, pos, false)
// if label.is_dirty {
render.clear(label.surface, label.bg)
render.put_text(label.surface, font, .(0, 0), label.fg, label.text)
// }
render.put_surface(surface, label.surface, pos, false)
}

View file

@ -128,4 +128,4 @@ render_clients := fn(screen: Surface): void {
screen.put_surface(window.surface, window.data.props.position, false)
i += 1
}
}
}

View file

@ -11,7 +11,7 @@ horizon_api := @use("../../../libraries/horizon_api/src/lib.hb");
main := fn(): void {
sunset.client.find_server()
window := sunset.client.new(.(.(400, 100), .(400, 300), "ableFetch!\0"))
window := sunset.client.new(.(.(10, 10), .(400, 300), "ableFetch!\0"))
font := @unwrap(render.text.font_from_psf2(@bitcast(&psf), false))
// pos := Vec2(uint).(1, 100)
@ -21,26 +21,27 @@ main := fn(): void {
}
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_3 := Label.new_label("wm : sunset\0", 300)
text_label.set_color(render.black, render.white)
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)
text_label_2.set_color(render.black, render.white)
text_label_3.set_color(render.black, render.white)
pos1 := Vec2(uint).(1, 1)
pos2 := Vec2(uint).(1, 20)
pos3 := Vec2(uint).(1, 40)
// render.clear(window.surface, render.black)
render_label_to_surface(window.surface, text_label, font, pos1)
render_label_to_surface(window.surface, text_label_2, font, pos2)
render_label_to_surface(window.surface, text_label_3, font, pos3)
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)
// stn.log.info("AAAA\0")
// render.put_text(text_label.surface, font, pos1, text_label.fg, text_label.text)
// render.put_text(text_label_2.surface, font, pos2, text_label_2.fg, text_label_2.text)
// render.put_text(text_label_3.surface, font, pos3, text_label_3.fg, text_label_3.text)
_ = sunset.client.send_frame(window)
// stn.sleep.sleep_until_interrupt(100)
}
}

View file

@ -0,0 +1,5 @@
# angels_halo
A Minix 3 style reincarnation service.
Running in the background restarting your drivers.

View file

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

View file

@ -0,0 +1,7 @@
(pkg angels-halo
(authors ("able"))
(version 0 1 0))
(dependencies
(libraries ())
(programs (hblang)))

View file

@ -0,0 +1,20 @@
stn := @use("stn");
.{log} := stn;
.{ProcessID} := stn.acs
Strategy := enum {
None,
Restart,
}
MonitoredProcess := struct {
pid: ProcessID,
}
main := fn(): int {
log.info("Angels Halo reincarnation server started.\0")
return 0
}

View file

@ -31,7 +31,7 @@ example := fn(): void {
window := @as(?sunset.Window, null)
if USE_SUNSET {
sunset.client.find_server()
window = sunset.client.new(.(.(400, 140), .(400, 400), "Mandelbrot Set\0"))
window = sunset.client.new(.(.(450, 140), .(400, 400), "Mandelbrot Set\0"))
if window == null {
log.error("got no window\0")
return
@ -91,4 +91,4 @@ example := fn(): void {
_ = sunset.client.send_frame(window)
}
}
}
}

View file

@ -13,7 +13,7 @@ main := fn(): void {
return
}
window := sunset.client.new(.(.(100, 100), .(200, 200), "Hello,\0"))
window := sunset.client.new(.(.(400, 400), .(200, 200), "Hello\0"))
if window == null {
log.error("got no window\0")
@ -26,4 +26,4 @@ main := fn(): void {
_ = sunset.client.send_frame(window)
x += 1
}
}
}

View file

@ -2,7 +2,7 @@
sunset := @use("../../../libraries/sunset_proto/src/lib.hb")
render := @use("../../../libraries/render/src/lib.hb")
bmp := @embed("../../../assets/able.bmp")
bmp := @embed("../../../assets/mini.bmp")
main := fn(): void {
sunset.client.find_server()
@ -13,7 +13,7 @@ main := fn(): void {
return
}
window := sunset.client.new(.(.(400, 100), .(400, 240), "Sunset!\0"))
window := sunset.client.new(.(.(100, 350), .(400, 240), "Sunset!\0"))
if window == null {
log.error("got no window\0")

View file

@ -11,6 +11,30 @@ stn := @use("../../../libraries/stn/src/lib.hb");
psf := @embed("../../../assets/consolefonts/tamsyn/10x20r.psf")
img := @embed("../../../assets/wallpaper.qoi")
Mouse := struct {
x: uint,
y: uint,
// TODO: Make this configurable via wm config
cursor_width: u8,
max_x: uint,
max_y: uint,
new := fn(max_x: uint, max_y: uint): Self {
center_x := max_x / 2
center_y := max_y / 2
return Self.(center_x, center_y, 3, max_x, max_y)
}
/*
center := fn(self: Self){
center_x := max_x / 2
center_y := max_y / 2
return Self.(center_x, center_y, 3, max_x, max_y)
}*/
}
main := fn(): int {
sunset.server.start()
defer {
@ -27,8 +51,11 @@ main := fn(): int {
return 1
}
mouse_x := 100
mouse_y := 100
// mouse_x := 100
// mouse_y := 100
mouse := Mouse.new(screen.width, screen.height)
//mouse.center()
text_label := Label.new_label("\0", 1024)
text_label.set_color(sunset.server.DECO_COLOUR, render.BLACK)
@ -40,24 +67,24 @@ main := fn(): int {
change_x = change_x << 8
change_x = change_x >> 8
mouse_x += change_x
if mouse_x <= 0 {
mouse_x = 0
mouse.x += change_x
if mouse.x <= 0 {
mouse.x = 0
}
if mouse_x >= screen.width - 20 {
mouse_x = @intcast(screen.width - 21)
if mouse.x >= screen.width - 20 {
mouse.x = @intcast(screen.width - 21)
}
change_y := @as(i16, mouse_event.y_change)
change_y = change_y << 8
change_y = change_y >> 8
mouse_y -= change_y
if mouse_y < 0 {
mouse_y = 1
mouse.y -= change_y
if mouse.y < 0 {
mouse.y = 1
}
if mouse_y >= screen.height - 20 {
mouse_y = @intcast(screen.height - 21)
if mouse.y >= screen.height - 20 {
mouse.y = @intcast(screen.height - 21)
}
if mouse_event.left {
@ -92,8 +119,8 @@ main := fn(): int {
// Mouse cursor
{
screen.put_filled_circle(.(mouse_x, mouse_y), 10, sunset.server.DECO_COLOUR_DARKER)
screen.put_circle(.(mouse_x, mouse_y), 10, sunset.server.DECO_COLOUR)
render.put_filled_circle(screen, .(mouse.x, mouse.y), mouse.cursor_width, sunset.server.DECO_COLOUR_DARKER)
render.put_circle(screen, .(mouse.x, mouse.y), mouse.cursor_width, sunset.server.DECO_COLOUR)
}
screen.sync()

View file

@ -26,8 +26,9 @@ resolution = "1024x768x24"
[boot.limine.ableos.modules.render_example]
path = "boot:///render_example.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.ps2_mouse_driver]
# path = "boot:///ps2_mouse_driver.hbf"
@ -38,11 +39,15 @@ path = "boot:///render_example.hbf"
# [boot.limine.ableos.modules.ps2_driver]
# path = "boot:///ps2_driver.hbf"
# [boot.limine.ableos.modules.sunset_client]
# path = "boot:///sunset_client.hbf"
# [boot.limine.ableos.modules.sunset_client_2]
# path = "boot:///sunset_client_2.hbf"
# [boot.limine.ableos.modules.ablefetch]
# path = "boot:///ablefetch.hbf"
[boot.limine.ableos.modules.ablefetch]
path = "boot:///ablefetch.hbf"
# [boot.limine.ableos.modules.diskio_driver]
# path = "boot:///diskio_driver.hbf"
#[boot.limine.ableos.modules.angels_halo]
#path = "boot:///angels_halo.hbf"