wheelScroll小模块支持指定按键

This commit is contained in:
MrZ626
2021-05-02 11:43:56 +08:00
parent 216bb4ea87
commit 3bca0336fa

View File

@@ -1,5 +1,5 @@
local floatWheel=0
return function(y)
return function(y,key1,key2)
if y>0 then
if floatWheel<0 then floatWheel=0 end
floatWheel=floatWheel+y^1.2
@@ -8,11 +8,11 @@ return function(y)
floatWheel=floatWheel-(-y)^1.2
end
while floatWheel>=1 do
love.keypressed("up")
love.keypressed(key1 or"up")
floatWheel=floatWheel-1
end
while floatWheel<=-1 do
love.keypressed("down")
love.keypressed(key2 or"down")
floatWheel=floatWheel+1
end
end