mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
love.wheelmoved: add preciseX, preciseY, and direction enum parameters.
Fixes #1910.
This commit is contained in:
@@ -294,6 +294,20 @@ Message *Event::convert(const SDL_Event &e)
|
||||
case SDL_MOUSEWHEEL:
|
||||
vargs.emplace_back((double) e.wheel.x);
|
||||
vargs.emplace_back((double) e.wheel.y);
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
// These values will be garbage if 2.0.18+ headers are used but a lower
|
||||
// version of SDL is used at runtime, but other bits of code already
|
||||
// prevent running in that situation.
|
||||
vargs.emplace_back((double) e.wheel.preciseX);
|
||||
vargs.emplace_back((double) e.wheel.preciseY);
|
||||
#else
|
||||
vargs.emplace_back((double) e.wheel.x);
|
||||
vargs.emplace_back((double) e.wheel.y);
|
||||
#endif
|
||||
|
||||
txt = e.wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? "flipped" : "standard";
|
||||
vargs.emplace_back(txt, strlen(txt));
|
||||
|
||||
msg = new Message("wheelmoved", vargs);
|
||||
break;
|
||||
case SDL_FINGERDOWN:
|
||||
|
||||
@@ -49,8 +49,8 @@ function love.createhandlers()
|
||||
mousereleased = function (x,y,b,t,c)
|
||||
if love.mousereleased then return love.mousereleased(x,y,b,t,c) end
|
||||
end,
|
||||
wheelmoved = function (x,y)
|
||||
if love.wheelmoved then return love.wheelmoved(x,y) end
|
||||
wheelmoved = function (x,y,px,py,dir)
|
||||
if love.wheelmoved then return love.wheelmoved(x,y,px,py,dir) end
|
||||
end,
|
||||
touchpressed = function (id,x,y,dx,dy,p)
|
||||
if love.touchpressed then return love.touchpressed(id,x,y,dx,dy,p) end
|
||||
|
||||
Reference in New Issue
Block a user