From 17f09faca55aa3e57041154419733f402c668e00 Mon Sep 17 00:00:00 2001 From: Ronja Date: Thu, 3 Sep 2020 17:31:23 +0200 Subject: [PATCH] current state --- Luxe/assets/wip/Human.png | Bin 156 -> 177 bytes Luxe/blocks/human/human.modifier.lx | 2 +- Luxe/blocks/human/human.wren | 22 ++++++++++++++------ Luxe/blocks/ui.wren | 11 +++++++++- Luxe/blocks/ui/image_button.wren | 10 ++++----- Luxe/game.wren | 19 +++++++++-------- Luxe/math/math.wren | 8 +++---- Luxe/math/util.wren | 31 ++++++++++++++++++++++++++-- Luxe/math/vector.wren | 12 +++++++---- Luxe/outline/renderer.wren | 20 ++++++++++++------ Luxe/outline/settings.settings.lx | 2 ++ 11 files changed, 98 insertions(+), 39 deletions(-) diff --git a/Luxe/assets/wip/Human.png b/Luxe/assets/wip/Human.png index 4b92d7a29f458b5bb466775600fb6feab6ff94d4..f839077149dd5658a748821afb0adb99f464b168 100644 GIT binary patch delta 136 zcmV;30C)eK0kHv)F@I}GL_t&-m4#5j5r7~JOFXx7iL!{hz#=YD=E9HVDn-l(E~E)5 zFrYmc`5>Cz0bpBBI_xXgWvrc=6Ic&C&;Y q{9jx9U)W6*yL_t&-m4#5-5x^h_i@gr0qv=dKSNzeQBBuF) other.x || one.y > other.y } + toString { + return "(%(x)|%(y))" + } + y0(){ _y = 0 return this @@ -64,12 +68,12 @@ class Vector is Sequence{ } iterate(iter){ - if(!iter) return 0 - if(iter > 1) return false + if(iter == null) return 0 + if(iter >= 1) return false return iter + 1 } - iteratorValue(iter){[iter]} + iteratorValue(iter){this[iter]} [index]{ if(index == 0){ @@ -77,7 +81,7 @@ class Vector is Sequence{ } else if(index == 1){ return y } - return null + return false } +(other){ diff --git a/Luxe/outline/renderer.wren b/Luxe/outline/renderer.wren index 4fef171..5b738c7 100644 --- a/Luxe/outline/renderer.wren +++ b/Luxe/outline/renderer.wren @@ -64,20 +64,28 @@ class Renderer { Image.redefine(_rt, _desc) - _gameRect = AABB.new((window - res*_pixel_size)/2, res * _pixel_size) + _texRect = AABB.new((window - _gameRes*_pixel_size)/2, _gameRes * _pixel_size) events.emit(Renderer.on_change) } game_mouse(mouse_pos){ - var window = AABB.new(0, 0, Render.window_w(), Render.window_h()) - var screen = AABB.new(_gameRect.min_x, Render.window_h() - _gameRect.max_y, _gameRect.width, _gameRect.height) //Y- mouse positions are the bane of my existance - return M.remap(screen.min, screen.max, window.min, window.max, 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 point = M.inv_lerp(game_rect.min, game_rect.max, mouse_pos) + //System.print(point) + return point } ui_mouse(mouse_pos){ + //good chance this works by luck and is not exact var window = AABB.new(0, 0, Render.window_w(), Render.window_h()) - var screen = AABB.new(_gameRect.min_x, Render.window_h() - _gameRect.max_y, _gameRect.width, _gameRect.height) //Y- mouse positions are the bane of my existance + var screen = AABB.new(_texRect.min_x, Render.window_h() - _texRect.max_y, _texRect.width, _texRect.height) //Y- mouse positions are the bane of my existance return M.remap(screen.min, screen.max, window.min, window.max, mouse_pos) } @@ -136,7 +144,7 @@ class Renderer { out_pass.targets = ["screen"] out_pass.inputs = { "pass.flipy" : true, - "pass.rect" : _gameRect.pos_size_list, + "pass.rect" : _texRect.pos_size_list, "pass.image" : { "image": target, //image resource name "sampler": "nearest_clamp" //sampler state diff --git a/Luxe/outline/settings.settings.lx b/Luxe/outline/settings.settings.lx index 4f27870..0e48f5f 100644 --- a/Luxe/outline/settings.settings.lx +++ b/Luxe/outline/settings.settings.lx @@ -13,4 +13,6 @@ engine = { stencil = 0 depth = 0 } + + ui.debug_vis = true } \ No newline at end of file