From 0744070143372f0dcea23e9b211d947bd68350f7 Mon Sep 17 00:00:00 2001 From: Ronja Date: Thu, 3 Sep 2020 18:24:42 +0200 Subject: [PATCH] finally fix input fuckery --- Luxe/blocks/ui.wren | 25 +++++++++++-------------- Luxe/outline/renderer.wren | 14 ++++++-------- Luxe/outline/settings.settings.lx | 2 +- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Luxe/blocks/ui.wren b/Luxe/blocks/ui.wren index a049b23..611604d 100644 --- a/Luxe/blocks/ui.wren +++ b/Luxe/blocks/ui.wren @@ -48,7 +48,7 @@ class Ui{ Control.set_size(root, ui_rect.width, ui_rect.height) //list - var list = UIList.create(_ui) + var list = Control.create(_ui) Control.set_id(list, "info list") Control.child_add(root, list) //todo: make list horizontal? @@ -70,7 +70,7 @@ class Ui{ ui_mode = Ui.Planning } } - UIList.add(list, button) + Control.child_add(list, button) //info button = list_button(1) @@ -78,7 +78,7 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Stats") ImageButton.set_tile_uv(button, tiles, [2, 0]) - UIList.add(list, button) + Control.child_add(list, button) //read diary button = list_button(2) @@ -86,7 +86,7 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Diary") ImageButton.set_tile_uv(button, tiles, [1, 0]) - UIList.add(list, button) + Control.child_add(list, button) //UIList.refresh(list) //uncomment this when list learns not to be vertical return root @@ -100,9 +100,8 @@ class Ui{ Control.set_size(root, ui_rect.width, ui_rect.height) //list - var list = UIList.create(_ui) + var list = Control.create(_ui) Control.child_add(root, list) - //todo: make list horizontal? Control.set_pos(list, 0, ui_rect.height-16) Control.set_size(list, ui_rect.width, 16) @@ -123,7 +122,7 @@ class Ui{ ui_mode = Ui.Info } } - UIList.add(list, button) + Control.child_add(list, button) list_id = list_id+1 //abort @@ -132,7 +131,7 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Abort") ImageButton.set_tile_uv(button, tiles, [0, 0]) - UIList.add(list, button) + Control.child_add(list, button) list_id = list_id+1 //people @@ -141,7 +140,7 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Adventurers") ImageButton.set_tile_uv(button, tiles, [2, 0]) - UIList.add(list, button) + Control.child_add(list, button) list_id = list_id+1 //stuff @@ -150,7 +149,7 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Stuff") ImageButton.set_tile_uv(button, tiles, [4, 0]) - UIList.add(list, button) + Control.child_add(list, button) list_id = list_id+1 //direction @@ -159,7 +158,7 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Direction") ImageButton.set_tile_uv(button, tiles, [3, 0]) - UIList.add(list, button) + Control.child_add(list, button) list_id = list_id+1 //go @@ -168,11 +167,9 @@ class Ui{ UIImage.set_image(button, adventureButtons) ImageButton.set_tooltip(button, "Depart") ImageButton.set_tile_uv(button, tiles, [5, 0]) - UIList.add(list, button) + Control.child_add(list, button) list_id = list_id+1 - //UIList.refresh(list) //uncomment this when list learns not to be vertical - return root } diff --git a/Luxe/outline/renderer.wren b/Luxe/outline/renderer.wren index 5b738c7..27a5347 100644 --- a/Luxe/outline/renderer.wren +++ b/Luxe/outline/renderer.wren @@ -70,16 +70,14 @@ class Renderer { } game_mouse(mouse_pos){ - //this is super inflexible, help :( var pixel_game_rect = Globals["GameRect"] - - var game_rect = AABB.new(_texRect.min_x + pixel_game_rect.min_x * _pixel_size, - _texRect.min_y + pixel_game_rect.min_y * _pixel_size, - pixel_game_rect.width * _pixel_size, pixel_game_rect.width * _pixel_size) + var window = AABB.new(0, 0, Render.window_w(), Render.window_h()) + //what a mess :/ + var screen = AABB.new(_texRect.min_x + pixel_game_rect.min_x * _pixel_size, + Render.window_h() - (_texRect.min_y + pixel_game_rect.max_y * _pixel_size), + pixel_game_rect.width * _pixel_size, pixel_game_rect.height * _pixel_size) - var point = M.inv_lerp(game_rect.min, game_rect.max, mouse_pos) - //System.print(point) - return point + return M.remap(screen.min, screen.max, window.min, window.max, mouse_pos) } ui_mouse(mouse_pos){ diff --git a/Luxe/outline/settings.settings.lx b/Luxe/outline/settings.settings.lx index 0e48f5f..aecd75d 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