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 | |
| parent | 756a3446b66d86c7ee785b69e7103c79a12bdf13 (diff) | |
Move the UI rendering outside of the canvas
| -rw-r--r-- | main.lua | 16 | ||||
| -rw-r--r-- | src/im.lua | 2 | ||||
| -rw-r--r-- | src/input.lua | 12 | ||||
| -rw-r--r-- | src/objs/player.lua | 2 |
4 files changed, 16 insertions, 16 deletions
@@ -48,14 +48,6 @@ function love.draw(dt) ground2:draw() player.box:draw() - im.begin_step() - - fire_event(scn.on_ui) - - im.draw() - - im.end_step() - -- TODO: Take care of weird displays lg.setCanvas() local scr_width, scr_height = lg.getDimensions() @@ -67,6 +59,14 @@ function love.draw(dt) WindowScale, WindowScale, SCR_WIDTH / 2, SCR_HEIGHT / 2) + im.begin_step() + + fire_event(scn.on_ui) + + im.draw() + + im.end_step() + lg.print(tostring(love.timer.getFPS())) lg.print("left "..tostring(player.box:touching_left()), 0, 20) lg.print("right "..tostring(player.box:touching_right()), 0, 40) @@ -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 |
