From b6b097a8722655dc75483c82b0087141072d598f Mon Sep 17 00:00:00 2001 From: Able Date: Wed, 6 Nov 2024 19:57:43 -0600 Subject: [PATCH] widgeting work --- sysdata/libraries/horizon_api/src/widgets.hb | 10 ++++++++-- sysdata/programs/horizon/src/main.hb | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sysdata/libraries/horizon_api/src/widgets.hb b/sysdata/libraries/horizon_api/src/widgets.hb index 9bf56f7..1fa04b5 100644 --- a/sysdata/libraries/horizon_api/src/widgets.hb +++ b/sysdata/libraries/horizon_api/src/widgets.hb @@ -40,12 +40,18 @@ render_label_to_surface := fn(surface: Surface, label: Label, font: Font, pos: V render.put_text(label.surface, font, .(0, 0), render.white, label.text) } render.put_surface(surface, label.surface, pos, false) - render.sync(surface) } new_label := fn(text: ^u8): Label { - text_surface := render.new_surface(100, 20) + text_surface := render.new_surface(1000, 20) text_length := string.length(text) label := Label.(true, text_surface, text, text_length) return label +} + +VerticalLayout := 0 +HorizontalLayout := 1 + +Container := struct { + layout: uint, } \ No newline at end of file diff --git a/sysdata/programs/horizon/src/main.hb b/sysdata/programs/horizon/src/main.hb index c33882e..ed405bb 100644 --- a/sysdata/programs/horizon/src/main.hb +++ b/sysdata/programs/horizon/src/main.hb @@ -77,6 +77,15 @@ main := fn(): int { // TODO: Get windows out of a collection and iter through render.put_rect(screen, .(0, 0), .(screen.width - 1, screen.height - 1), render.white) + { + // Scroll bar :ThumbsUp: + render.put_rect(screen, .(100, 100), .(100, 10), render.white) + render.put_filled_rect(screen, .(110, 100), .(20, 10), render.white) + + render.put_rect(screen, .(90, 110), .(10, 100), render.white) + render.put_filled_rect(screen, .(90, 120), .(10, 20), render.white) + } + { pos := Vec2(uint).(1, screen.height - 21) render_label_to_surface(screen, text_label, font, pos)