1
0
Fork 0
forked from AbleOS/ableos

local changes 👍

This commit is contained in:
Able 2024-12-16 07:58:04 -06:00 committed by peony
parent dc43529c7b
commit f1598a044e
12 changed files with 124 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 {
render.clear(label.surface, label.bg)
render.put_text(label.surface, font, .(0, 0), label.fg, label.text)
}
// 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

@ -132,4 +132,4 @@ render_clients := fn(screen: Surface): void {
put_surface(screen, 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

@ -59,7 +59,7 @@ $Y_MAX := 1.12
// if you use the minibrot this should be at least 100 to actually see the minibrot,
// if you use the mandelbrot it looks best under 30
$MAX_MAX_ITERATION := 10000
$MAX_MAX_ITERATION := 100
$USE_SUNSET := true
@ -79,7 +79,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
@ -97,6 +97,7 @@ example := fn(): void {
y_scale := (Y_MAX - Y_MIN) / @floatcast(@itf(@bitcast(screen.height)))
loop if max_iteration >= MAX_MAX_ITERATION break else {
log.info("Iteration complete.\0")
py := 0
loop if py == screen.height break else {
px := 0
@ -165,4 +166,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
{
render.put_filled_circle(screen, .(mouse_x, mouse_y), 10, sunset.server.DECO_COLOUR_DARKER)
render.put_circle(screen, .(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)
}
render.sync(screen)

View file

@ -25,6 +25,7 @@ resolution = "1024x768x24"
[boot.limine.ableos.modules.render_example]
path = "boot:///render_example.hbf"
[boot.limine.ableos.modules.sunset_server]
path = "boot:///sunset_server.hbf"
@ -37,13 +38,15 @@ path = "boot:///ps2_mouse_driver.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]
# 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"