buggy code

This commit is contained in:
Able 2024-10-15 17:25:11 -05:00
parent ed7c8f20cb
commit 84f86488c7
2 changed files with 36 additions and 23 deletions

View file

@ -1,14 +1,14 @@
stn := @use("../../../libraries/stn/src/lib.hb");
.{string, memory, buffer} := stn
.{string, memory, buffer, random} := stn;
.{Vec2} := stn.math
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb")
render := @use("../../../libraries/render/src/lib.hb");
.{Vec2} := @use("../../../libraries/stn/src/lib.hb").math
render := @use("../../../libraries/render/src/lib.hb")
Window := struct {
// TODO: Replace this with widgets
// implicit_framebuffer:
implicit_framebuffer: render.Surface,
width: int,
height: int,
x: int,
@ -17,21 +17,34 @@ Window := struct {
main := fn(): int {
a := buffer.create("XHorizon\0")
// BUG: Backbuffering is disabled
screen := render.init(true)
image := render.new_surface(screen.width / 3, screen.height / 3)
// 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: Get windows out of the hashmap
render.clear(image, render.white)
// 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, image, pos)
render.put_surface(screen, window, pos)
}
// Sync the screen
render.sync(screen)
}

View file

@ -8,28 +8,28 @@ ignim := @use("../../../libraries/ignim/src/lib.hb");
.{errors} := ignim
main := fn(): int {
windowing_system_buffer := buffer.create("XHorizon\0")
windowing_system_buffer := buffer.search("XHorizon\0")
// TODO: get WindowID
create_window(windowing_system_buffer)
program_name := "Horizon Testing Program\0"
program_version := ignim.version.make_version(0, 1, 0)
engine_name := "None\0"
engine_version := ignim.version.make_version(0, 0, 0)
api_version := ignim.version.make_api_version(0, 1, 0, 0)
// program_name := "Horizon Testing Program\0"
// program_version := ignim.version.make_version(0, 1, 0)
// engine_name := "None\0"
// engine_version := ignim.version.make_version(0, 0, 0)
// api_version := ignim.version.make_api_version(0, 1, 0, 0)
app_info := ignim.application.new_application_info(program_name, program_version, engine_name, engine_version, api_version)
// app_info := ignim.application.new_application_info(program_name, program_version, engine_name, engine_version, api_version)
create_info := ignim.instance.new_create_info(&app_info)
// create_info := ignim.instance.new_create_info(&app_info)
instance := ignim.instance.void_instance()
// instance := ignim.instance.void_instance()
// TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance
ret := ignim.instance.create_instance(&create_info, 0, &instance)
if ret == errors.IncompatibleDriver {
log.error("Driver Incompatible with Vulkan\0")
}
// // TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance
// ret := ignim.instance.create_instance(&create_info, 0, &instance)
// if ret == errors.IncompatibleDriver {
// log.error("Driver Incompatible with Vulkan\0")
// }
return 0
}