2024-09-13 16:40:05 -05:00
|
|
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
2024-10-15 17:25:11 -05:00
|
|
|
.{string, memory, buffer, random} := stn;
|
|
|
|
.{Vec2} := stn.math
|
2024-09-13 16:40:05 -05:00
|
|
|
|
|
|
|
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb")
|
|
|
|
|
2024-10-15 17:25:11 -05:00
|
|
|
render := @use("../../../libraries/render/src/lib.hb")
|
2024-10-15 17:06:38 -05:00
|
|
|
|
|
|
|
Window := struct {
|
|
|
|
// TODO: Replace this with widgets
|
2024-10-15 17:25:11 -05:00
|
|
|
implicit_framebuffer: render.Surface,
|
2024-10-15 17:06:38 -05:00
|
|
|
width: int,
|
|
|
|
height: int,
|
|
|
|
x: int,
|
|
|
|
y: int,
|
|
|
|
}
|
|
|
|
|
2024-09-13 16:40:05 -05:00
|
|
|
main := fn(): int {
|
|
|
|
a := buffer.create("XHorizon\0")
|
2024-10-15 17:25:11 -05:00
|
|
|
|
|
|
|
// BUG: Backbuffering is disabled
|
2024-10-15 17:06:38 -05:00
|
|
|
screen := render.init(true)
|
|
|
|
|
2024-10-15 17:25:11 -05:00
|
|
|
// Clear the screen to black.
|
|
|
|
render.clear(screen, render.black)
|
|
|
|
|
|
|
|
window := render.new_surface(screen.width / 3, screen.height / 3)
|
2024-10-15 17:06:38 -05:00
|
|
|
|
|
|
|
pos := Vec2(int).(100, 100)
|
|
|
|
|
2024-10-15 17:25:11 -05:00
|
|
|
color := random.range(render.Color, render.black, render.white)
|
|
|
|
|
2024-09-13 16:40:05 -05:00
|
|
|
loop {
|
2024-10-15 17:06:38 -05:00
|
|
|
// Clear the screen
|
|
|
|
render.clear(screen, render.black)
|
|
|
|
|
2024-10-15 17:25:11 -05:00
|
|
|
// 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)
|
|
|
|
}
|
2024-10-15 17:06:38 -05:00
|
|
|
|
|
|
|
// Sync the screen
|
|
|
|
render.sync(screen)
|
2024-09-13 16:40:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|