From 1ad9014fb18a124703ff3c1d3961e4cda63e0afd Mon Sep 17 00:00:00 2001 From: Ronja Date: Sun, 6 Sep 2020 17:04:41 +0200 Subject: [PATCH] ui bug? --- Luxe/blocks/ui.wren | 27 +++++++++++++++++---------- Luxe/blocks/ui/simple_text.wren | 18 ++++++++++++++++++ Luxe/outline/settings.settings.lx | 2 +- 3 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 Luxe/blocks/ui/simple_text.wren diff --git a/Luxe/blocks/ui.wren b/Luxe/blocks/ui.wren index 8dc54f4..ee1b44a 100644 --- a/Luxe/blocks/ui.wren +++ b/Luxe/blocks/ui.wren @@ -6,16 +6,19 @@ import "luxe: ui/list" for UIList import "luxe: ui/button" for UIButton import "luxe: ui/image" for UIImage import "luxe: assets" for Assets +import "luxe: ui/text" for UIText import "globals" for Globals import "blocks/ui/image_button" for ImageButton import "math/observable" for Observable -import "blocks/human/human" for Human +import "blocks/ui/simple_text" for UISimpleText class Ui{ static Planning{"planning"} static Info {"info"} + font{"assets/fonts/BabyBlocks"} + ui_mode{_ui_mode.value} ui_mode=(v){_ui_mode.value = v} @@ -40,7 +43,6 @@ class Ui{ } game.Focus.on_change() {|val| - System.print(val) ui_mode = Ui.Info } @@ -83,13 +85,12 @@ class Ui{ ui_mode = Ui.Planning } } - + //info button = list_button(list) UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Stats") ImageButton.set_tile_uv(button, tiles, [2, 0]) - Control.child_add(list, button) //read diary button = list_button(list) @@ -105,6 +106,12 @@ class Ui{ } setup_info_human(root){ + var portrait = UIImage.create(_ui) + Control.set_pos(portrait, 1, 1) + Control.set_size(portrait, 30, 46) + Control.set_id(portrait, "person info portrait") + Control.child_add(root, portrait) + var frame = UIImage.create(_ui) UIImage.set_image(frame, Assets.image("assets/wip/Frame")) Control.set_pos(frame, 1, 1) @@ -112,16 +119,14 @@ class Ui{ Control.set_id(frame, "person info frame") Control.child_add(root, frame) - var portrait = UIImage.create(_ui) - Control.set_size(portrait, 30, 46) - Control.set_id(portrait, "person info portrait") - Control.child_add(frame, portrait) - Globals["Game"].Focus.on_change(true) {|val| //todo: more sophisticated portrait generation UIImage.set_image(portrait, Assets.image("assets/wip/Portrait")) - UIImage.set_color(portrait, Human.get_color(val) || [1, 1, 1, 1]) + UIImage.set_color(portrait, Human.get_color(val) || [0, 0, 0, 1]) } + + var name = Control.create(_ui) + Control.set_pos(name, 32, 1) } setup_planning(){ @@ -191,6 +196,7 @@ class Ui{ var i = Control.child_index(parent, button) Control.set_size(button, 16, 16) Control.set_pos(button, i*16, 0) //let list handle this in future + System.print("%(Control.get_pos_x(button)), %(Control.get_pos_y(button))") return button } @@ -198,5 +204,6 @@ class Ui{ ImageButton.get_data(_test) } } + //this is behind the class def to make cyclic dependency happy lol import "blocks/human/human" for Human \ No newline at end of file diff --git a/Luxe/blocks/ui/simple_text.wren b/Luxe/blocks/ui/simple_text.wren new file mode 100644 index 0000000..26e063c --- /dev/null +++ b/Luxe/blocks/ui/simple_text.wren @@ -0,0 +1,18 @@ +import "luxe: ui/control" for Control + +class UISimpleText{ + + static create(ent){ + var text = Control.create(ent) + + Control.set_render(text) {|control, state, x,y,w,h| + //System.print(control) + } + return text + } + + static set_text(con, text){ + System.print(text) + } + +} \ No newline at end of file diff --git a/Luxe/outline/settings.settings.lx b/Luxe/outline/settings.settings.lx index ffe71ab..1f7655a 100644 --- a/Luxe/outline/settings.settings.lx +++ b/Luxe/outline/settings.settings.lx @@ -14,5 +14,5 @@ engine = { depth = 0 } - //ui.debug_vis = true + ui.debug_vis = true } \ No newline at end of file