Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-03-01 18:32:41 -04:00
parent 3830a0969c
commit 2f419c1c83
79 changed files with 601 additions and 566 deletions
+8 -8
View File
@@ -350,7 +350,7 @@ Message *Event::convert(const SDL_Event &e) const
{
Proxy proxy;
proxy.object = new love::filesystem::DroppedFile(e.drop.file);
proxy.flags = FILESYSTEM_DROPPED_FILE_T;
proxy.type = FILESYSTEM_DROPPED_FILE_ID;
vargs.push_back(new Variant(FILESYSTEM_DROPPED_FILE_ID, &proxy));
msg = new Message("filedropped", vargs);
proxy.object->release();
@@ -400,7 +400,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
{
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
proxy.object = joymodule->getJoystickFromID(e.jbutton.which);
if (!proxy.object)
break;
@@ -413,7 +413,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
break;
case SDL_JOYAXISMOTION:
{
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
proxy.object = joymodule->getJoystickFromID(e.jaxis.which);
if (!proxy.object)
break;
@@ -429,7 +429,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
if (!joystick::sdl::Joystick::getConstant(e.jhat.value, hat) || !joystick::Joystick::getConstant(hat, txt))
break;
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
proxy.object = joymodule->getJoystickFromID(e.jhat.which);
if (!proxy.object)
break;
@@ -447,7 +447,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
if (!joystick::Joystick::getConstant(padbutton, txt))
break;
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
proxy.object = joymodule->getJoystickFromID(e.cbutton.which);
if (!proxy.object)
break;
@@ -463,7 +463,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
if (!joystick::Joystick::getConstant(padaxis, txt))
break;
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
proxy.object = joymodule->getJoystickFromID(e.caxis.which);
if (!proxy.object)
break;
@@ -479,7 +479,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
case SDL_JOYDEVICEADDED:
// jdevice.which is the joystick device index.
proxy.object = joymodule->addJoystick(e.jdevice.which);
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
if (proxy.object)
{
vargs.push_back(new Variant(JOYSTICK_JOYSTICK_ID, (void *) &proxy));
@@ -489,7 +489,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
case SDL_JOYDEVICEREMOVED:
// jdevice.which is the joystick instance ID now.
proxy.object = joymodule->getJoystickFromID(e.jdevice.which);
proxy.flags = JOYSTICK_JOYSTICK_T;
proxy.type = JOYSTICK_JOYSTICK_ID;
if (proxy.object)
{
joymodule->removeJoystick((joystick::Joystick *) proxy.object);
+1 -1
View File
@@ -129,7 +129,7 @@ extern "C" int luaopen_love_event(lua_State *L)
WrappedModule w;
w.module = instance;
w.name = "event";
w.flags = MODULE_T;
w.type = MODULE_ID;
w.functions = functions;
w.types = 0;