diff options
| author | iamcheeseman <[email protected]> | 2026-03-12 16:41:55 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-03-12 16:41:55 -0400 |
| commit | e3634a80ad29221b9fc0cc60a543027074096dd1 (patch) | |
| tree | 485cb8f15523d21be36cc9c33283ba296a6337bd /src | |
| parent | 756a3446b66d86c7ee785b69e7103c79a12bdf13 (diff) | |
Move the UI rendering outside of the canvas
Diffstat (limited to 'src')
| -rw-r--r-- | src/im.lua | 2 | ||||
| -rw-r--r-- | src/input.lua | 12 | ||||
| -rw-r--r-- | src/objs/player.lua | 2 |
3 files changed, 8 insertions, 8 deletions
@@ -344,7 +344,7 @@ function im.begin_window(title, x, y, w, h, opts) title_x, title_y = win.x + 1, win.y + 1 end - stencil_cmd(0, 0, viewport:getDimensions()) + stencil_cmd(0, 0, love.graphics.getDimensions()) rect_cmd(win.x, win.y, win.w, win.h, unpack(im.cols.border)) diff --git a/src/input.lua b/src/input.lua index c5c9012..b2951b2 100644 --- a/src/input.lua +++ b/src/input.lua @@ -57,20 +57,20 @@ end function love.mousepressed(_, _, btn) mouseEvents[btn] = true - local sx, sy = get_mouse_pos() + local sx, sy = love.mouse.getPosition() --get_mouse_pos() im.mousepressed(sx, sy, btn) end function love.mousereleased(_, _, btn) - local sx, sy = get_mouse_pos() + local sx, sy = love.mouse.getPosition() --get_mouse_pos() im.mousereleased(sx, sy, btn) end function love.mousemoved(_, _, dx, dy) - local sx, sy = get_mouse_pos() - local scrw, scrh = love.graphics.getDimensions() - local rdx, rdy = dx / scrw * SCR_WIDTH, dy / scrh * SCR_HEIGHT - im.mousemoved(sx, sy, rdx, rdy) + local sx, sy = love.mouse.getPosition() --get_mouse_pos() + -- local scrw, scrh = love.graphics.getDimensions() + -- local rdx, rdy = dx / scrw * SCR_WIDTH, dy / scrh * SCR_HEIGHT + im.mousemoved(sx, sy, dx, dy) end function love.wheelmoved(...) diff --git a/src/objs/player.lua b/src/objs/player.lua index 0903372..c046c7c 100644 --- a/src/objs/player.lua +++ b/src/objs/player.lua @@ -44,7 +44,7 @@ function player_movement_sys(player, dt) end function player_ui_sys(_) - im.begin_window("Room Editor", 5, 5, 50, 50, {}) + im.begin_window("Room Editor", 120, 5, 180, 320, {}) im.layout({0.5, 0.75, 1}) im.text("Tile: " .. tostring(tile)) if im.button(" - ") then |
