Fix some bugs (TEST)

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-24 23:53:43 +07:00
parent 4d4bfd1482
commit 17f31a61bb
4 changed files with 20 additions and 24 deletions

View File

@@ -96,14 +96,13 @@ function love.load()
}
end
local scale_factor
function love.resize(w, h)
scale_factor = math.min(w / 640, h / 480)
SCREEN_SCALE_FACTOR = math.min(w / 640, h / 480)
GLOBAL_TRANSFORM:setTransformation(
(w - scale_factor * 640) / 2,
(h - scale_factor * 480) / 2,
(w - SCREEN_SCALE_FACTOR * 640) / 2,
(h - SCREEN_SCALE_FACTOR * 480) / 2,
0,
scale_factor
SCREEN_SCALE_FACTOR
)
end
@@ -152,7 +151,7 @@ end
function love.mousemoved(x, y, dx, dy, isTouch)
if isTouch then return end
local x,y=GLOBAL_TRANSFORM:inverseTransformPoint(x,y)
local dx,dy=dx/scale_factor,dy/scale_factor
local dx,dy=dx/SCREEN_SCALE_FACTOR,dy/SCREEN_SCALE_FACTOR
SCENE:onInputMove{type = "mouse", x = x, y = y, dx = dx, dy = dy}
end
function love.wheelmoved(dx, dy)