23 lines
464 B
Lua
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
|