forked from AbleOS/ableos
53 lines
1.1 KiB
Plaintext
53 lines
1.1 KiB
Plaintext
stn := @use("../../../libraries/stn/src/lib.hb");
|
|
.{string, memory, buffer, random} := stn;
|
|
.{Vec2} := stn.math
|
|
|
|
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb")
|
|
|
|
render := @use("../../../libraries/render/src/lib.hb")
|
|
|
|
Window := struct {
|
|
// TODO: Replace this with widgets
|
|
implicit_framebuffer: render.Surface,
|
|
width: int,
|
|
height: int,
|
|
x: int,
|
|
y: int,
|
|
}
|
|
|
|
main := fn(): int {
|
|
a := buffer.create("XHorizon\0")
|
|
|
|
// BUG: Backbuffering is disabled
|
|
screen := render.init(true)
|
|
|
|
// Clear the screen to black.
|
|
render.clear(screen, render.black)
|
|
|
|
window := render.new_surface(screen.width / 3, screen.height / 3)
|
|
|
|
pos := Vec2(int).(100, 100)
|
|
|
|
color := random.range(render.Color, render.black, render.white)
|
|
|
|
loop {
|
|
// Clear the screen
|
|
render.clear(screen, render.black)
|
|
|
|
// TODO: Read the window buffer here
|
|
|
|
// TODO: Get windows out of a collection and iter through
|
|
//
|
|
{
|
|
render.clear(window, render.white)
|
|
|
|
// Apply the image to the screen
|
|
render.put_surface(screen, window, pos)
|
|
}
|
|
|
|
// Sync the screen
|
|
render.sync(screen)
|
|
}
|
|
|
|
return 0
|
|
} |