From 84f86488c797eae4959b6a49e9d2b786ba4c6d72 Mon Sep 17 00:00:00 2001 From: Able Date: Tue, 15 Oct 2024 17:25:11 -0500 Subject: [PATCH] buggy code --- sysdata/programs/horizon/src/main.hb | 31 +++++++++++++------ .../horizon_testing_program/src/main.hb | 28 ++++++++--------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/sysdata/programs/horizon/src/main.hb b/sysdata/programs/horizon/src/main.hb index ada7eed..9fc340a 100644 --- a/sysdata/programs/horizon/src/main.hb +++ b/sysdata/programs/horizon/src/main.hb @@ -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, window, pos) + } - // Apply the image to the screen - render.put_surface(screen, image, pos) // Sync the screen render.sync(screen) } diff --git a/sysdata/programs/horizon_testing_program/src/main.hb b/sysdata/programs/horizon_testing_program/src/main.hb index 01d57a3..b8f9316 100644 --- a/sysdata/programs/horizon_testing_program/src/main.hb +++ b/sysdata/programs/horizon_testing_program/src/main.hb @@ -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 } \ No newline at end of file