diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp index c2a2b648c..aec8340ed 100644 --- a/src/modules/event/sdl/Event.cpp +++ b/src/modules/event/sdl/Event.cpp @@ -196,24 +196,11 @@ Message *Event::convert(const SDL_Event &e) const } break; case SDL_MOUSEWHEEL: - if (e.wheel.y != 0) - { - button = (e.wheel.y > 0) ? mouse::Mouse::BUTTON_WHEELUP : mouse::Mouse::BUTTON_WHEELDOWN; - if (!love::mouse::Mouse::getConstant(button, txt)) - break; - - int mx, my; - SDL_GetMouseState(&mx, &my); - windowToPixelCoords(&mx, &my); - - arg1 = new Variant((double) mx); - arg2 = new Variant((double) my); - arg3 = new Variant(txt, strlen(txt)); - msg = new Message("mousepressed", arg1, arg2, arg3); - arg1->release(); - arg2->release(); - arg3->release(); - } + arg1 = new Variant((double) e.wheel.x); + arg2 = new Variant((double) e.wheel.y); + msg = new Message("wheelmoved", arg1, arg2); + arg1->release(); + arg2->release(); break; case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: diff --git a/src/modules/mouse/Mouse.cpp b/src/modules/mouse/Mouse.cpp index 10db0ecd9..c8eceacc9 100644 --- a/src/modules/mouse/Mouse.cpp +++ b/src/modules/mouse/Mouse.cpp @@ -40,8 +40,6 @@ StringMap::Entry Mouse::buttonEntries[] = {"l", Mouse::BUTTON_LEFT}, {"m", Mouse::BUTTON_MIDDLE}, {"r", Mouse::BUTTON_RIGHT}, - {"wu", Mouse::BUTTON_WHEELUP}, - {"wd", Mouse::BUTTON_WHEELDOWN}, {"x1", Mouse::BUTTON_X1}, {"x2", Mouse::BUTTON_X2}, }; diff --git a/src/modules/mouse/Mouse.h b/src/modules/mouse/Mouse.h index 90d73d727..baede9d68 100644 --- a/src/modules/mouse/Mouse.h +++ b/src/modules/mouse/Mouse.h @@ -44,8 +44,6 @@ public: BUTTON_RIGHT, BUTTON_X1, BUTTON_X2, - BUTTON_WHEELUP, - BUTTON_WHEELDOWN, BUTTON_MAX_ENUM }; diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index a429f5f98..b76541074 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -170,6 +170,9 @@ function love.createhandlers() mousereleased = function (x,y,b) if love.mousereleased then return love.mousereleased(x,y,b) end end, + wheelmoved = function (x,y) + if love.wheelmoved then return love.wheelmoved(x,y) end + end, joystickpressed = function (j,b) if love.joystickpressed then return love.joystickpressed(j,b) end end, diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index bc20b5af5..0882126df 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -297,6 +297,13 @@ const unsigned char boot_lua[] = 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a, + 0x09, 0x09, 0x77, 0x68, 0x65, 0x65, 0x6c, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x29, 0x0a, + 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x68, 0x65, 0x65, 0x6c, 0x6d, 0x6f, + 0x76, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f, + 0x76, 0x65, 0x2e, 0x77, 0x68, 0x65, 0x65, 0x6c, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x28, 0x78, 0x2c, 0x79, 0x29, + 0x20, 0x65, 0x6e, 0x64, 0x0a, + 0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x09, 0x09, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x6a, 0x2c, 0x62, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63,