diff options
| author | iamcheeseman <[email protected]> | 2026-04-03 09:44:29 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-04-03 09:44:29 -0400 |
| commit | 623c351bab9e63c421939dc94d6930f9d94ba8d8 (patch) | |
| tree | 961d11d9c84113a6c42c1b558fde59d60287e348 /src/input.lua | |
| parent | 94cc023a056ebc49ed883739e9f42f51598e57a0 (diff) | |
| parent | f26ba2147c7325595780bdc5dae56f1315e5495e (diff) | |
Merge branch 'main' of ssh://codeberg.org/the-gutter/gutshot
Diffstat (limited to 'src/input.lua')
| -rw-r--r-- | src/input.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/input.lua b/src/input.lua index 5dacd81..7c625ed 100644 --- a/src/input.lua +++ b/src/input.lua @@ -101,12 +101,25 @@ function love.wheelmoved(...) end function get_mouse_pos() + local cam = get_active_camera() local scrw, scrh = love.graphics.getDimensions() + local offset_x = (scrw - SCR_WIDTH * WindowScale) / 2 local offset_y = (scrh - SCR_HEIGHT * WindowScale) / 2 - return (lm.getX() - offset_x) / WindowScale, - (lm.getY() - offset_y) / WindowScale + local mx = (lm.getX() - offset_x) / WindowScale + local my = (lm.getY() - offset_y) / WindowScale + + mx = mx - SCR_WIDTH / 2 + my = my - SCR_HEIGHT / 2 + + mx = mx / cam.zoom + my = my / cam.zoom + + mx = mx + cam.realx + my = my + cam.realy + + return mx, my end function input_step() |
