mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Removed the 'wu' and 'wd' constants for love.mousepressed, added new love.wheelmoved(x, y) event callback.
+x is mousewheel-right, +y is mousewheel-up. --HG-- branch : minor
This commit is contained in:
@@ -196,24 +196,11 @@ Message *Event::convert(const SDL_Event &e) const
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
if (e.wheel.y != 0)
|
arg1 = new Variant((double) e.wheel.x);
|
||||||
{
|
arg2 = new Variant((double) e.wheel.y);
|
||||||
button = (e.wheel.y > 0) ? mouse::Mouse::BUTTON_WHEELUP : mouse::Mouse::BUTTON_WHEELDOWN;
|
msg = new Message("wheelmoved", arg1, arg2);
|
||||||
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();
|
arg1->release();
|
||||||
arg2->release();
|
arg2->release();
|
||||||
arg3->release();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_JOYBUTTONDOWN:
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_JOYBUTTONUP:
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ StringMap<Mouse::Button, Mouse::BUTTON_MAX_ENUM>::Entry Mouse::buttonEntries[] =
|
|||||||
{"l", Mouse::BUTTON_LEFT},
|
{"l", Mouse::BUTTON_LEFT},
|
||||||
{"m", Mouse::BUTTON_MIDDLE},
|
{"m", Mouse::BUTTON_MIDDLE},
|
||||||
{"r", Mouse::BUTTON_RIGHT},
|
{"r", Mouse::BUTTON_RIGHT},
|
||||||
{"wu", Mouse::BUTTON_WHEELUP},
|
|
||||||
{"wd", Mouse::BUTTON_WHEELDOWN},
|
|
||||||
{"x1", Mouse::BUTTON_X1},
|
{"x1", Mouse::BUTTON_X1},
|
||||||
{"x2", Mouse::BUTTON_X2},
|
{"x2", Mouse::BUTTON_X2},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ public:
|
|||||||
BUTTON_RIGHT,
|
BUTTON_RIGHT,
|
||||||
BUTTON_X1,
|
BUTTON_X1,
|
||||||
BUTTON_X2,
|
BUTTON_X2,
|
||||||
BUTTON_WHEELUP,
|
|
||||||
BUTTON_WHEELDOWN,
|
|
||||||
BUTTON_MAX_ENUM
|
BUTTON_MAX_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,9 @@ function love.createhandlers()
|
|||||||
mousereleased = function (x,y,b)
|
mousereleased = function (x,y,b)
|
||||||
if love.mousereleased then return love.mousereleased(x,y,b) end
|
if love.mousereleased then return love.mousereleased(x,y,b) end
|
||||||
end,
|
end,
|
||||||
|
wheelmoved = function (x,y)
|
||||||
|
if love.wheelmoved then return love.wheelmoved(x,y) end
|
||||||
|
end,
|
||||||
joystickpressed = function (j,b)
|
joystickpressed = function (j,b)
|
||||||
if love.joystickpressed then return love.joystickpressed(j,b) end
|
if love.joystickpressed then return love.joystickpressed(j,b) end
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -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,
|
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,
|
0x64, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a,
|
||||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 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,
|
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,
|
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,
|
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63,
|
||||||
|
|||||||
Reference in New Issue
Block a user