heroes-of-nerevelon/lib/wheelscroll.lua
Neckrat 0293409dd9 camera refactor
Co-authored-by: Ivan Yuriev <ivanyr44@gmail.com>
2025-08-02 02:16:20 +03:00

23 lines
464 B
Lua

local Vec3 = require "lib/vec3"
local MIDDLE_BUTTON = 3
--- @class (exact) WheelScroll
--- @field x number
--- @field y number
--- @field delta Vec3
local wheelscroll = {
x = 0.0,
y = 0.0,
delta = Vec3 {}
}
function love.mousepressed(x, y, button)
if button == MIDDLE_BUTTON then
wheelscroll.delta = Vec3 { wheelscroll.x, wheelscroll.y } - Vec3 { x, y }
wheelscroll.x = x
wheelscroll.y = y
end
end
return wheelscroll