CRLF to LF

This commit is contained in:
Bart van Strien
2012-07-04 14:40:24 +02:00
parent a970f1df97
commit 7793e7f02f
414 changed files with 94042 additions and 94042 deletions
+297 -297
View File
@@ -1,297 +1,297 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Event.h"
using love::thread::Mutex;
using love::thread::Lock;
namespace love
{
namespace event
{
Message::Message(std::string name, Variant *a, Variant *b, Variant *c, Variant *d)
: name(name)
, nargs(0)
{
args[0] = a;
args[1] = b;
args[2] = c;
args[3] = d;
for (int i = 0; i < 4; i++)
{
if (!args[i])
continue;
args[i]->retain();
nargs++;
}
}
Message::~Message()
{
for (int i = 0; i < nargs; i++)
args[i]->release();
}
int Message::toLua(lua_State *L)
{
luax_pushstring(L, name);
for (int i = 0; i < nargs; i++)
args[i]->toLua(L);
return nargs+1;
}
Message *Message::fromLua(lua_State *L, int n)
{
std::string name = luax_checkstring(L, n);
n++;
Message *m = new Message(name);
for (int i = 0; i < 4; i++)
{
if (lua_isnoneornil(L, n+i))
break;
m->args[i] = Variant::fromLua(L, n+i);
if (!m->args[i])
{
delete m;
luaL_error(L, "Argument %d can't be stored safely\nExpected boolean, number, string or userdata.", n+i);
return NULL;
}
m->nargs++;
}
return m;
}
Event::~Event()
{
}
void Event::push(Message *msg)
{
Lock lock(mutex);
msg->retain();
queue.push(msg);
}
bool Event::poll(Message *&msg)
{
Lock lock(mutex);
if (queue.empty())
return false;
msg = queue.front();
queue.pop();
return true;
}
void Event::clear()
{
Lock lock(mutex);
while (!queue.empty())
{
queue.back()->release();
queue.pop();
}
}
bool Event::getConstant(const char *in, love::mouse::Mouse::Button &out)
{
return buttons.find(in, out);
}
bool Event::getConstant(love::mouse::Mouse::Button in, const char *&out)
{
return buttons.find(in, out);
}
bool Event::getConstant(const char *in, love::keyboard::Keyboard::Key &out)
{
return keys.find(in, out);
}
bool Event::getConstant(love::keyboard::Keyboard::Key in, const char *&out)
{
return keys.find(in, out);
}
StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry Event::buttonEntries[] =
{
{"l", love::mouse::Mouse::BUTTON_LEFT},
{"m", love::mouse::Mouse::BUTTON_MIDDLE},
{"r", love::mouse::Mouse::BUTTON_RIGHT},
{"wu", love::mouse::Mouse::BUTTON_WHEELUP},
{"wd", love::mouse::Mouse::BUTTON_WHEELDOWN},
{"x1", love::mouse::Mouse::BUTTON_X1},
{"x2", love::mouse::Mouse::BUTTON_X2},
};
StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM> Event::buttons(Event::buttonEntries, sizeof(Event::buttonEntries));
StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry Event::keyEntries[] =
{
{"backspace", love::keyboard::Keyboard::KEY_BACKSPACE},
{"tab", love::keyboard::Keyboard::KEY_TAB},
{"clear", love::keyboard::Keyboard::KEY_CLEAR},
{"return", love::keyboard::Keyboard::KEY_RETURN},
{"pause", love::keyboard::Keyboard::KEY_PAUSE},
{"escape", love::keyboard::Keyboard::KEY_ESCAPE},
{" ", love::keyboard::Keyboard::KEY_SPACE},
{"!", love::keyboard::Keyboard::KEY_EXCLAIM},
{"\"", love::keyboard::Keyboard::KEY_QUOTEDBL},
{"#", love::keyboard::Keyboard::KEY_HASH},
{"$", love::keyboard::Keyboard::KEY_DOLLAR},
{"&", love::keyboard::Keyboard::KEY_AMPERSAND},
{"'", love::keyboard::Keyboard::KEY_QUOTE},
{"(", love::keyboard::Keyboard::KEY_LEFTPAREN},
{")", love::keyboard::Keyboard::KEY_RIGHTPAREN},
{"*", love::keyboard::Keyboard::KEY_ASTERISK},
{"+", love::keyboard::Keyboard::KEY_PLUS},
{",", love::keyboard::Keyboard::KEY_COMMA},
{"-", love::keyboard::Keyboard::KEY_MINUS},
{".", love::keyboard::Keyboard::KEY_PERIOD},
{"/", love::keyboard::Keyboard::KEY_SLASH},
{"0", love::keyboard::Keyboard::KEY_0},
{"1", love::keyboard::Keyboard::KEY_1},
{"2", love::keyboard::Keyboard::KEY_2},
{"3", love::keyboard::Keyboard::KEY_3},
{"4", love::keyboard::Keyboard::KEY_4},
{"5", love::keyboard::Keyboard::KEY_5},
{"6", love::keyboard::Keyboard::KEY_6},
{"7", love::keyboard::Keyboard::KEY_7},
{"8", love::keyboard::Keyboard::KEY_8},
{"9", love::keyboard::Keyboard::KEY_9},
{":", love::keyboard::Keyboard::KEY_COLON},
{";", love::keyboard::Keyboard::KEY_SEMICOLON},
{"<", love::keyboard::Keyboard::KEY_LESS},
{"=", love::keyboard::Keyboard::KEY_EQUALS},
{">", love::keyboard::Keyboard::KEY_GREATER},
{"?", love::keyboard::Keyboard::KEY_QUESTION},
{"@", love::keyboard::Keyboard::KEY_AT},
{"[", love::keyboard::Keyboard::KEY_LEFTBRACKET},
{"\\", love::keyboard::Keyboard::KEY_BACKSLASH},
{"]", love::keyboard::Keyboard::KEY_RIGHTBRACKET},
{"^", love::keyboard::Keyboard::KEY_CARET},
{"_", love::keyboard::Keyboard::KEY_UNDERSCORE},
{"`", love::keyboard::Keyboard::KEY_BACKQUOTE},
{"a", love::keyboard::Keyboard::KEY_A},
{"b", love::keyboard::Keyboard::KEY_B},
{"c", love::keyboard::Keyboard::KEY_C},
{"d", love::keyboard::Keyboard::KEY_D},
{"e", love::keyboard::Keyboard::KEY_E},
{"f", love::keyboard::Keyboard::KEY_F},
{"g", love::keyboard::Keyboard::KEY_G},
{"h", love::keyboard::Keyboard::KEY_H},
{"i", love::keyboard::Keyboard::KEY_I},
{"j", love::keyboard::Keyboard::KEY_J},
{"k", love::keyboard::Keyboard::KEY_K},
{"l", love::keyboard::Keyboard::KEY_L},
{"m", love::keyboard::Keyboard::KEY_M},
{"n", love::keyboard::Keyboard::KEY_N},
{"o", love::keyboard::Keyboard::KEY_O},
{"p", love::keyboard::Keyboard::KEY_P},
{"q", love::keyboard::Keyboard::KEY_Q},
{"r", love::keyboard::Keyboard::KEY_R},
{"s", love::keyboard::Keyboard::KEY_S},
{"t", love::keyboard::Keyboard::KEY_T},
{"u", love::keyboard::Keyboard::KEY_U},
{"v", love::keyboard::Keyboard::KEY_V},
{"w", love::keyboard::Keyboard::KEY_W},
{"x", love::keyboard::Keyboard::KEY_X},
{"y", love::keyboard::Keyboard::KEY_Y},
{"z", love::keyboard::Keyboard::KEY_Z},
{"delete", love::keyboard::Keyboard::KEY_DELETE},
{"kp0", love::keyboard::Keyboard::KEY_KP0},
{"kp1", love::keyboard::Keyboard::KEY_KP1},
{"kp2", love::keyboard::Keyboard::KEY_KP2},
{"kp3", love::keyboard::Keyboard::KEY_KP3},
{"kp4", love::keyboard::Keyboard::KEY_KP4},
{"kp5", love::keyboard::Keyboard::KEY_KP5},
{"kp6", love::keyboard::Keyboard::KEY_KP6},
{"kp7", love::keyboard::Keyboard::KEY_KP7},
{"kp8", love::keyboard::Keyboard::KEY_KP8},
{"kp9", love::keyboard::Keyboard::KEY_KP9},
{"kp.", love::keyboard::Keyboard::KEY_KP_PERIOD},
{"kp/", love::keyboard::Keyboard::KEY_KP_DIVIDE},
{"kp*", love::keyboard::Keyboard::KEY_KP_MULTIPLY},
{"kp-", love::keyboard::Keyboard::KEY_KP_MINUS},
{"kp+", love::keyboard::Keyboard::KEY_KP_PLUS},
{"kpenter", love::keyboard::Keyboard::KEY_KP_ENTER},
{"kp=", love::keyboard::Keyboard::KEY_KP_EQUALS},
{"up", love::keyboard::Keyboard::KEY_UP},
{"down", love::keyboard::Keyboard::KEY_DOWN},
{"right", love::keyboard::Keyboard::KEY_RIGHT},
{"left", love::keyboard::Keyboard::KEY_LEFT},
{"insert", love::keyboard::Keyboard::KEY_INSERT},
{"home", love::keyboard::Keyboard::KEY_HOME},
{"end", love::keyboard::Keyboard::KEY_END},
{"pageup", love::keyboard::Keyboard::KEY_PAGEUP},
{"pagedown", love::keyboard::Keyboard::KEY_PAGEDOWN},
{"f1", love::keyboard::Keyboard::KEY_F1},
{"f2", love::keyboard::Keyboard::KEY_F2},
{"f3", love::keyboard::Keyboard::KEY_F3},
{"f4", love::keyboard::Keyboard::KEY_F4},
{"f5", love::keyboard::Keyboard::KEY_F5},
{"f6", love::keyboard::Keyboard::KEY_F6},
{"f7", love::keyboard::Keyboard::KEY_F7},
{"f8", love::keyboard::Keyboard::KEY_F8},
{"f9", love::keyboard::Keyboard::KEY_F9},
{"f10", love::keyboard::Keyboard::KEY_F10},
{"f11", love::keyboard::Keyboard::KEY_F11},
{"f12", love::keyboard::Keyboard::KEY_F12},
{"f13", love::keyboard::Keyboard::KEY_F13},
{"f14", love::keyboard::Keyboard::KEY_F14},
{"f15", love::keyboard::Keyboard::KEY_F15},
{"numlock", love::keyboard::Keyboard::KEY_NUMLOCK},
{"capslock", love::keyboard::Keyboard::KEY_CAPSLOCK},
{"scrollock", love::keyboard::Keyboard::KEY_SCROLLOCK},
{"rshift", love::keyboard::Keyboard::KEY_RSHIFT},
{"lshift", love::keyboard::Keyboard::KEY_LSHIFT},
{"rctrl", love::keyboard::Keyboard::KEY_RCTRL},
{"lctrl", love::keyboard::Keyboard::KEY_LCTRL},
{"ralt", love::keyboard::Keyboard::KEY_RALT},
{"lalt", love::keyboard::Keyboard::KEY_LALT},
{"rmeta", love::keyboard::Keyboard::KEY_RMETA},
{"lmeta", love::keyboard::Keyboard::KEY_LMETA},
{"lsuper", love::keyboard::Keyboard::KEY_LSUPER},
{"rsuper", love::keyboard::Keyboard::KEY_RSUPER},
{"mode", love::keyboard::Keyboard::KEY_MODE},
{"compose", love::keyboard::Keyboard::KEY_COMPOSE},
{"help", love::keyboard::Keyboard::KEY_HELP},
{"print", love::keyboard::Keyboard::KEY_PRINT},
{"sysreq", love::keyboard::Keyboard::KEY_SYSREQ},
{"break", love::keyboard::Keyboard::KEY_BREAK},
{"menu", love::keyboard::Keyboard::KEY_MENU},
{"power", love::keyboard::Keyboard::KEY_POWER},
{"euro", love::keyboard::Keyboard::KEY_EURO},
{"undo", love::keyboard::Keyboard::KEY_UNDO},
{"unknown", love::keyboard::Keyboard::KEY_UNKNOWN},
};
StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM> Event::keys(Event::keyEntries, sizeof(Event::keyEntries));
} // event
} // love
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Event.h"
using love::thread::Mutex;
using love::thread::Lock;
namespace love
{
namespace event
{
Message::Message(std::string name, Variant *a, Variant *b, Variant *c, Variant *d)
: name(name)
, nargs(0)
{
args[0] = a;
args[1] = b;
args[2] = c;
args[3] = d;
for (int i = 0; i < 4; i++)
{
if (!args[i])
continue;
args[i]->retain();
nargs++;
}
}
Message::~Message()
{
for (int i = 0; i < nargs; i++)
args[i]->release();
}
int Message::toLua(lua_State *L)
{
luax_pushstring(L, name);
for (int i = 0; i < nargs; i++)
args[i]->toLua(L);
return nargs+1;
}
Message *Message::fromLua(lua_State *L, int n)
{
std::string name = luax_checkstring(L, n);
n++;
Message *m = new Message(name);
for (int i = 0; i < 4; i++)
{
if (lua_isnoneornil(L, n+i))
break;
m->args[i] = Variant::fromLua(L, n+i);
if (!m->args[i])
{
delete m;
luaL_error(L, "Argument %d can't be stored safely\nExpected boolean, number, string or userdata.", n+i);
return NULL;
}
m->nargs++;
}
return m;
}
Event::~Event()
{
}
void Event::push(Message *msg)
{
Lock lock(mutex);
msg->retain();
queue.push(msg);
}
bool Event::poll(Message *&msg)
{
Lock lock(mutex);
if (queue.empty())
return false;
msg = queue.front();
queue.pop();
return true;
}
void Event::clear()
{
Lock lock(mutex);
while (!queue.empty())
{
queue.back()->release();
queue.pop();
}
}
bool Event::getConstant(const char *in, love::mouse::Mouse::Button &out)
{
return buttons.find(in, out);
}
bool Event::getConstant(love::mouse::Mouse::Button in, const char *&out)
{
return buttons.find(in, out);
}
bool Event::getConstant(const char *in, love::keyboard::Keyboard::Key &out)
{
return keys.find(in, out);
}
bool Event::getConstant(love::keyboard::Keyboard::Key in, const char *&out)
{
return keys.find(in, out);
}
StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry Event::buttonEntries[] =
{
{"l", love::mouse::Mouse::BUTTON_LEFT},
{"m", love::mouse::Mouse::BUTTON_MIDDLE},
{"r", love::mouse::Mouse::BUTTON_RIGHT},
{"wu", love::mouse::Mouse::BUTTON_WHEELUP},
{"wd", love::mouse::Mouse::BUTTON_WHEELDOWN},
{"x1", love::mouse::Mouse::BUTTON_X1},
{"x2", love::mouse::Mouse::BUTTON_X2},
};
StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM> Event::buttons(Event::buttonEntries, sizeof(Event::buttonEntries));
StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry Event::keyEntries[] =
{
{"backspace", love::keyboard::Keyboard::KEY_BACKSPACE},
{"tab", love::keyboard::Keyboard::KEY_TAB},
{"clear", love::keyboard::Keyboard::KEY_CLEAR},
{"return", love::keyboard::Keyboard::KEY_RETURN},
{"pause", love::keyboard::Keyboard::KEY_PAUSE},
{"escape", love::keyboard::Keyboard::KEY_ESCAPE},
{" ", love::keyboard::Keyboard::KEY_SPACE},
{"!", love::keyboard::Keyboard::KEY_EXCLAIM},
{"\"", love::keyboard::Keyboard::KEY_QUOTEDBL},
{"#", love::keyboard::Keyboard::KEY_HASH},
{"$", love::keyboard::Keyboard::KEY_DOLLAR},
{"&", love::keyboard::Keyboard::KEY_AMPERSAND},
{"'", love::keyboard::Keyboard::KEY_QUOTE},
{"(", love::keyboard::Keyboard::KEY_LEFTPAREN},
{")", love::keyboard::Keyboard::KEY_RIGHTPAREN},
{"*", love::keyboard::Keyboard::KEY_ASTERISK},
{"+", love::keyboard::Keyboard::KEY_PLUS},
{",", love::keyboard::Keyboard::KEY_COMMA},
{"-", love::keyboard::Keyboard::KEY_MINUS},
{".", love::keyboard::Keyboard::KEY_PERIOD},
{"/", love::keyboard::Keyboard::KEY_SLASH},
{"0", love::keyboard::Keyboard::KEY_0},
{"1", love::keyboard::Keyboard::KEY_1},
{"2", love::keyboard::Keyboard::KEY_2},
{"3", love::keyboard::Keyboard::KEY_3},
{"4", love::keyboard::Keyboard::KEY_4},
{"5", love::keyboard::Keyboard::KEY_5},
{"6", love::keyboard::Keyboard::KEY_6},
{"7", love::keyboard::Keyboard::KEY_7},
{"8", love::keyboard::Keyboard::KEY_8},
{"9", love::keyboard::Keyboard::KEY_9},
{":", love::keyboard::Keyboard::KEY_COLON},
{";", love::keyboard::Keyboard::KEY_SEMICOLON},
{"<", love::keyboard::Keyboard::KEY_LESS},
{"=", love::keyboard::Keyboard::KEY_EQUALS},
{">", love::keyboard::Keyboard::KEY_GREATER},
{"?", love::keyboard::Keyboard::KEY_QUESTION},
{"@", love::keyboard::Keyboard::KEY_AT},
{"[", love::keyboard::Keyboard::KEY_LEFTBRACKET},
{"\\", love::keyboard::Keyboard::KEY_BACKSLASH},
{"]", love::keyboard::Keyboard::KEY_RIGHTBRACKET},
{"^", love::keyboard::Keyboard::KEY_CARET},
{"_", love::keyboard::Keyboard::KEY_UNDERSCORE},
{"`", love::keyboard::Keyboard::KEY_BACKQUOTE},
{"a", love::keyboard::Keyboard::KEY_A},
{"b", love::keyboard::Keyboard::KEY_B},
{"c", love::keyboard::Keyboard::KEY_C},
{"d", love::keyboard::Keyboard::KEY_D},
{"e", love::keyboard::Keyboard::KEY_E},
{"f", love::keyboard::Keyboard::KEY_F},
{"g", love::keyboard::Keyboard::KEY_G},
{"h", love::keyboard::Keyboard::KEY_H},
{"i", love::keyboard::Keyboard::KEY_I},
{"j", love::keyboard::Keyboard::KEY_J},
{"k", love::keyboard::Keyboard::KEY_K},
{"l", love::keyboard::Keyboard::KEY_L},
{"m", love::keyboard::Keyboard::KEY_M},
{"n", love::keyboard::Keyboard::KEY_N},
{"o", love::keyboard::Keyboard::KEY_O},
{"p", love::keyboard::Keyboard::KEY_P},
{"q", love::keyboard::Keyboard::KEY_Q},
{"r", love::keyboard::Keyboard::KEY_R},
{"s", love::keyboard::Keyboard::KEY_S},
{"t", love::keyboard::Keyboard::KEY_T},
{"u", love::keyboard::Keyboard::KEY_U},
{"v", love::keyboard::Keyboard::KEY_V},
{"w", love::keyboard::Keyboard::KEY_W},
{"x", love::keyboard::Keyboard::KEY_X},
{"y", love::keyboard::Keyboard::KEY_Y},
{"z", love::keyboard::Keyboard::KEY_Z},
{"delete", love::keyboard::Keyboard::KEY_DELETE},
{"kp0", love::keyboard::Keyboard::KEY_KP0},
{"kp1", love::keyboard::Keyboard::KEY_KP1},
{"kp2", love::keyboard::Keyboard::KEY_KP2},
{"kp3", love::keyboard::Keyboard::KEY_KP3},
{"kp4", love::keyboard::Keyboard::KEY_KP4},
{"kp5", love::keyboard::Keyboard::KEY_KP5},
{"kp6", love::keyboard::Keyboard::KEY_KP6},
{"kp7", love::keyboard::Keyboard::KEY_KP7},
{"kp8", love::keyboard::Keyboard::KEY_KP8},
{"kp9", love::keyboard::Keyboard::KEY_KP9},
{"kp.", love::keyboard::Keyboard::KEY_KP_PERIOD},
{"kp/", love::keyboard::Keyboard::KEY_KP_DIVIDE},
{"kp*", love::keyboard::Keyboard::KEY_KP_MULTIPLY},
{"kp-", love::keyboard::Keyboard::KEY_KP_MINUS},
{"kp+", love::keyboard::Keyboard::KEY_KP_PLUS},
{"kpenter", love::keyboard::Keyboard::KEY_KP_ENTER},
{"kp=", love::keyboard::Keyboard::KEY_KP_EQUALS},
{"up", love::keyboard::Keyboard::KEY_UP},
{"down", love::keyboard::Keyboard::KEY_DOWN},
{"right", love::keyboard::Keyboard::KEY_RIGHT},
{"left", love::keyboard::Keyboard::KEY_LEFT},
{"insert", love::keyboard::Keyboard::KEY_INSERT},
{"home", love::keyboard::Keyboard::KEY_HOME},
{"end", love::keyboard::Keyboard::KEY_END},
{"pageup", love::keyboard::Keyboard::KEY_PAGEUP},
{"pagedown", love::keyboard::Keyboard::KEY_PAGEDOWN},
{"f1", love::keyboard::Keyboard::KEY_F1},
{"f2", love::keyboard::Keyboard::KEY_F2},
{"f3", love::keyboard::Keyboard::KEY_F3},
{"f4", love::keyboard::Keyboard::KEY_F4},
{"f5", love::keyboard::Keyboard::KEY_F5},
{"f6", love::keyboard::Keyboard::KEY_F6},
{"f7", love::keyboard::Keyboard::KEY_F7},
{"f8", love::keyboard::Keyboard::KEY_F8},
{"f9", love::keyboard::Keyboard::KEY_F9},
{"f10", love::keyboard::Keyboard::KEY_F10},
{"f11", love::keyboard::Keyboard::KEY_F11},
{"f12", love::keyboard::Keyboard::KEY_F12},
{"f13", love::keyboard::Keyboard::KEY_F13},
{"f14", love::keyboard::Keyboard::KEY_F14},
{"f15", love::keyboard::Keyboard::KEY_F15},
{"numlock", love::keyboard::Keyboard::KEY_NUMLOCK},
{"capslock", love::keyboard::Keyboard::KEY_CAPSLOCK},
{"scrollock", love::keyboard::Keyboard::KEY_SCROLLOCK},
{"rshift", love::keyboard::Keyboard::KEY_RSHIFT},
{"lshift", love::keyboard::Keyboard::KEY_LSHIFT},
{"rctrl", love::keyboard::Keyboard::KEY_RCTRL},
{"lctrl", love::keyboard::Keyboard::KEY_LCTRL},
{"ralt", love::keyboard::Keyboard::KEY_RALT},
{"lalt", love::keyboard::Keyboard::KEY_LALT},
{"rmeta", love::keyboard::Keyboard::KEY_RMETA},
{"lmeta", love::keyboard::Keyboard::KEY_LMETA},
{"lsuper", love::keyboard::Keyboard::KEY_LSUPER},
{"rsuper", love::keyboard::Keyboard::KEY_RSUPER},
{"mode", love::keyboard::Keyboard::KEY_MODE},
{"compose", love::keyboard::Keyboard::KEY_COMPOSE},
{"help", love::keyboard::Keyboard::KEY_HELP},
{"print", love::keyboard::Keyboard::KEY_PRINT},
{"sysreq", love::keyboard::Keyboard::KEY_SYSREQ},
{"break", love::keyboard::Keyboard::KEY_BREAK},
{"menu", love::keyboard::Keyboard::KEY_MENU},
{"power", love::keyboard::Keyboard::KEY_POWER},
{"euro", love::keyboard::Keyboard::KEY_EURO},
{"undo", love::keyboard::Keyboard::KEY_UNDO},
{"unknown", love::keyboard::Keyboard::KEY_UNKNOWN},
};
StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM> Event::keys(Event::keyEntries, sizeof(Event::keyEntries));
} // event
} // love
+83 -83
View File
@@ -1,83 +1,83 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_EVENT_EVENT_H
#define LOVE_EVENT_EVENT_H
// LOVE
#include "common/Module.h"
#include "common/StringMap.h"
#include "common/Variant.h"
#include "keyboard/Keyboard.h"
#include "mouse/Mouse.h"
#include "thread/threads.h"
// STL
#include <queue>
namespace love
{
namespace event
{
class Message : public Object
{
private:
std::string name;
Variant *args[4];
int nargs;
public:
Message(std::string name, Variant *a = NULL, Variant *b = NULL, Variant *c = NULL, Variant *d = NULL);
~Message();
int toLua(lua_State *L);
static Message *fromLua(lua_State *L, int n);
};
class Event : public Module
{
public:
virtual ~Event();
void push(Message *msg);
bool poll(Message *&msg);
virtual void clear();
virtual void pump() = 0;
static bool getConstant(const char *in, love::mouse::Mouse::Button &out);
static bool getConstant(love::mouse::Mouse::Button in, const char *&out);
static bool getConstant(const char *in, love::keyboard::Keyboard::Key &out);
static bool getConstant(love::keyboard::Keyboard::Key in, const char *&out);
protected:
thread::Mutex mutex;
std::queue<Message *> queue;
static StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry buttonEntries[];
static StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM> buttons;
static StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry keyEntries[];
static StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM> keys;
}; // Event
} // event
} // love
#endif // LOVE_EVENT_EVENT_H
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_EVENT_EVENT_H
#define LOVE_EVENT_EVENT_H
// LOVE
#include "common/Module.h"
#include "common/StringMap.h"
#include "common/Variant.h"
#include "keyboard/Keyboard.h"
#include "mouse/Mouse.h"
#include "thread/threads.h"
// STL
#include <queue>
namespace love
{
namespace event
{
class Message : public Object
{
private:
std::string name;
Variant *args[4];
int nargs;
public:
Message(std::string name, Variant *a = NULL, Variant *b = NULL, Variant *c = NULL, Variant *d = NULL);
~Message();
int toLua(lua_State *L);
static Message *fromLua(lua_State *L, int n);
};
class Event : public Module
{
public:
virtual ~Event();
void push(Message *msg);
bool poll(Message *&msg);
virtual void clear();
virtual void pump() = 0;
static bool getConstant(const char *in, love::mouse::Mouse::Button &out);
static bool getConstant(love::mouse::Mouse::Button in, const char *&out);
static bool getConstant(const char *in, love::keyboard::Keyboard::Key &out);
static bool getConstant(love::keyboard::Keyboard::Key in, const char *&out);
protected:
thread::Mutex mutex;
std::queue<Message *> queue;
static StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry buttonEntries[];
static StringMap<love::mouse::Mouse::Button, love::mouse::Mouse::BUTTON_MAX_ENUM> buttons;
static StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry keyEntries[];
static StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM> keys;
}; // Event
} // event
} // love
#endif // LOVE_EVENT_EVENT_H
+314 -314
View File
@@ -1,314 +1,314 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Event.h"
#include "keyboard/Keyboard.h"
#include "mouse/Mouse.h"
namespace love
{
namespace event
{
namespace sdl
{
const char *Event::getName() const
{
return "love.event.sdl";
}
Event::Event()
{
SDL_EnableUNICODE(1);
}
void Event::pump()
{
SDL_PumpEvents();
static SDL_Event e;
SDL_EnableUNICODE(1);
Message *msg;
while (SDL_PollEvent(&e))
{
msg = convert(e);
if (msg)
{
push(msg);
msg->release();
}
}
}
Message *Event::wait()
{
static SDL_Event e;
bool ok = (SDL_WaitEvent(&e) == 1);
if (!ok)
return NULL;
return convert(e);
}
void Event::clear()
{
static SDL_Event e;
while (SDL_PollEvent(&e))
{
// Do nothing with 'e' ...
}
love::event::Event::clear();
}
Message *Event::convert(SDL_Event &e)
{
Message *msg = NULL;
love::keyboard::Keyboard::Key key;
love::mouse::Mouse::Button button;
Variant *arg1, *arg2, *arg3;
const char *txt;
switch (e.type)
{
case SDL_KEYDOWN:
if (keys.find(e.key.keysym.sym, key) && love::event::Event::keys.find(key, txt))
{
arg1 = new Variant(txt, strlen(txt));
arg2 = new Variant((double) e.key.keysym.unicode);
msg = new Message("keypressed", arg1, arg2);
arg1->release();
arg2->release();
}
break;
case SDL_KEYUP:
if (keys.find(e.key.keysym.sym, key) && love::event::Event::keys.find(key, txt))
{
arg1 = new Variant(txt, strlen(txt));
msg = new Message("keyreleased", arg1);
arg1->release();
}
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
if (buttons.find(e.button.button, button) && love::event::Event::buttons.find(button, txt))
{
arg1 = new Variant((double) e.button.x);
arg2 = new Variant((double) e.button.y);
arg3 = new Variant(txt, strlen(txt));
msg = new Message((e.type == SDL_MOUSEBUTTONDOWN) ?
"mousepressed" : "mousereleased",
arg1, arg2, arg3);
arg1->release();
arg2->release();
arg3->release();
}
break;
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
arg1 = new Variant((double)(e.jbutton.which+1));
arg2 = new Variant((double)(e.jbutton.button+1));
msg = new Message((e.type == SDL_JOYBUTTONDOWN) ?
"joystickpressed" : "joystickreleased",
arg1, arg2);
arg1->release();
arg2->release();
break;
case SDL_ACTIVEEVENT:
arg1 = new Variant(e.active.gain != 0);
if (e.active.state & SDL_APPINPUTFOCUS)
msg = new Message("focus", arg1);
arg1->release();
break;
case SDL_QUIT:
msg = new Message("quit");
break;
}
return msg;
}
EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry Event::keyEntries[] =
{
{ love::keyboard::Keyboard::KEY_BACKSPACE, SDLK_BACKSPACE},
{ love::keyboard::Keyboard::KEY_TAB, SDLK_TAB},
{ love::keyboard::Keyboard::KEY_CLEAR, SDLK_CLEAR},
{ love::keyboard::Keyboard::KEY_RETURN, SDLK_RETURN},
{ love::keyboard::Keyboard::KEY_PAUSE, SDLK_PAUSE},
{ love::keyboard::Keyboard::KEY_ESCAPE, SDLK_ESCAPE },
{ love::keyboard::Keyboard::KEY_SPACE, SDLK_SPACE },
{ love::keyboard::Keyboard::KEY_EXCLAIM, SDLK_EXCLAIM },
{ love::keyboard::Keyboard::KEY_QUOTEDBL, SDLK_QUOTEDBL },
{ love::keyboard::Keyboard::KEY_HASH, SDLK_HASH },
{ love::keyboard::Keyboard::KEY_DOLLAR, SDLK_DOLLAR },
{ love::keyboard::Keyboard::KEY_AMPERSAND, SDLK_AMPERSAND },
{ love::keyboard::Keyboard::KEY_QUOTE, SDLK_QUOTE },
{ love::keyboard::Keyboard::KEY_LEFTPAREN, SDLK_LEFTPAREN },
{ love::keyboard::Keyboard::KEY_RIGHTPAREN, SDLK_RIGHTPAREN },
{ love::keyboard::Keyboard::KEY_ASTERISK, SDLK_ASTERISK },
{ love::keyboard::Keyboard::KEY_PLUS, SDLK_PLUS },
{ love::keyboard::Keyboard::KEY_COMMA, SDLK_COMMA },
{ love::keyboard::Keyboard::KEY_MINUS, SDLK_MINUS },
{ love::keyboard::Keyboard::KEY_PERIOD, SDLK_PERIOD },
{ love::keyboard::Keyboard::KEY_SLASH, SDLK_SLASH },
{ love::keyboard::Keyboard::KEY_0, SDLK_0 },
{ love::keyboard::Keyboard::KEY_1, SDLK_1 },
{ love::keyboard::Keyboard::KEY_2, SDLK_2 },
{ love::keyboard::Keyboard::KEY_3, SDLK_3 },
{ love::keyboard::Keyboard::KEY_4, SDLK_4 },
{ love::keyboard::Keyboard::KEY_5, SDLK_5 },
{ love::keyboard::Keyboard::KEY_6, SDLK_6 },
{ love::keyboard::Keyboard::KEY_7, SDLK_7 },
{ love::keyboard::Keyboard::KEY_8, SDLK_8 },
{ love::keyboard::Keyboard::KEY_9, SDLK_9 },
{ love::keyboard::Keyboard::KEY_COLON, SDLK_COLON },
{ love::keyboard::Keyboard::KEY_SEMICOLON, SDLK_SEMICOLON },
{ love::keyboard::Keyboard::KEY_LESS, SDLK_LESS },
{ love::keyboard::Keyboard::KEY_EQUALS, SDLK_EQUALS },
{ love::keyboard::Keyboard::KEY_GREATER, SDLK_GREATER },
{ love::keyboard::Keyboard::KEY_QUESTION, SDLK_QUESTION },
{ love::keyboard::Keyboard::KEY_AT, SDLK_AT },
{ love::keyboard::Keyboard::KEY_LEFTBRACKET, SDLK_LEFTBRACKET },
{ love::keyboard::Keyboard::KEY_BACKSLASH, SDLK_BACKSLASH },
{ love::keyboard::Keyboard::KEY_RIGHTBRACKET, SDLK_RIGHTBRACKET },
{ love::keyboard::Keyboard::KEY_CARET, SDLK_CARET },
{ love::keyboard::Keyboard::KEY_UNDERSCORE, SDLK_UNDERSCORE },
{ love::keyboard::Keyboard::KEY_BACKQUOTE, SDLK_BACKQUOTE },
{ love::keyboard::Keyboard::KEY_A, SDLK_a },
{ love::keyboard::Keyboard::KEY_B, SDLK_b },
{ love::keyboard::Keyboard::KEY_C, SDLK_c },
{ love::keyboard::Keyboard::KEY_D, SDLK_d },
{ love::keyboard::Keyboard::KEY_E, SDLK_e },
{ love::keyboard::Keyboard::KEY_F, SDLK_f },
{ love::keyboard::Keyboard::KEY_G, SDLK_g },
{ love::keyboard::Keyboard::KEY_H, SDLK_h },
{ love::keyboard::Keyboard::KEY_I, SDLK_i },
{ love::keyboard::Keyboard::KEY_J, SDLK_j },
{ love::keyboard::Keyboard::KEY_K, SDLK_k },
{ love::keyboard::Keyboard::KEY_L, SDLK_l },
{ love::keyboard::Keyboard::KEY_M, SDLK_m },
{ love::keyboard::Keyboard::KEY_N, SDLK_n },
{ love::keyboard::Keyboard::KEY_O, SDLK_o },
{ love::keyboard::Keyboard::KEY_P, SDLK_p },
{ love::keyboard::Keyboard::KEY_Q, SDLK_q },
{ love::keyboard::Keyboard::KEY_R, SDLK_r },
{ love::keyboard::Keyboard::KEY_S, SDLK_s },
{ love::keyboard::Keyboard::KEY_T, SDLK_t },
{ love::keyboard::Keyboard::KEY_U, SDLK_u },
{ love::keyboard::Keyboard::KEY_V, SDLK_v },
{ love::keyboard::Keyboard::KEY_W, SDLK_w },
{ love::keyboard::Keyboard::KEY_X, SDLK_x },
{ love::keyboard::Keyboard::KEY_Y, SDLK_y },
{ love::keyboard::Keyboard::KEY_Z, SDLK_z },
{ love::keyboard::Keyboard::KEY_DELETE, SDLK_DELETE },
{ love::keyboard::Keyboard::KEY_KP0, SDLK_KP0 },
{ love::keyboard::Keyboard::KEY_KP1, SDLK_KP1 },
{ love::keyboard::Keyboard::KEY_KP2, SDLK_KP2 },
{ love::keyboard::Keyboard::KEY_KP3, SDLK_KP3 },
{ love::keyboard::Keyboard::KEY_KP4, SDLK_KP4 },
{ love::keyboard::Keyboard::KEY_KP5, SDLK_KP5 },
{ love::keyboard::Keyboard::KEY_KP6, SDLK_KP6 },
{ love::keyboard::Keyboard::KEY_KP7, SDLK_KP7 },
{ love::keyboard::Keyboard::KEY_KP8, SDLK_KP8 },
{ love::keyboard::Keyboard::KEY_KP9, SDLK_KP9 },
{ love::keyboard::Keyboard::KEY_KP_PERIOD, SDLK_KP_PERIOD },
{ love::keyboard::Keyboard::KEY_KP_DIVIDE, SDLK_KP_DIVIDE },
{ love::keyboard::Keyboard::KEY_KP_MULTIPLY, SDLK_KP_MULTIPLY},
{ love::keyboard::Keyboard::KEY_KP_MINUS, SDLK_KP_MINUS },
{ love::keyboard::Keyboard::KEY_KP_PLUS, SDLK_KP_PLUS },
{ love::keyboard::Keyboard::KEY_KP_ENTER, SDLK_KP_ENTER },
{ love::keyboard::Keyboard::KEY_KP_EQUALS, SDLK_KP_EQUALS },
{ love::keyboard::Keyboard::KEY_UP, SDLK_UP },
{ love::keyboard::Keyboard::KEY_DOWN, SDLK_DOWN },
{ love::keyboard::Keyboard::KEY_RIGHT, SDLK_RIGHT },
{ love::keyboard::Keyboard::KEY_LEFT, SDLK_LEFT },
{ love::keyboard::Keyboard::KEY_INSERT, SDLK_INSERT },
{ love::keyboard::Keyboard::KEY_HOME, SDLK_HOME },
{ love::keyboard::Keyboard::KEY_END, SDLK_END },
{ love::keyboard::Keyboard::KEY_PAGEUP, SDLK_PAGEUP },
{ love::keyboard::Keyboard::KEY_PAGEDOWN, SDLK_PAGEDOWN },
{ love::keyboard::Keyboard::KEY_F1, SDLK_F1 },
{ love::keyboard::Keyboard::KEY_F2, SDLK_F2 },
{ love::keyboard::Keyboard::KEY_F3, SDLK_F3 },
{ love::keyboard::Keyboard::KEY_F4, SDLK_F4 },
{ love::keyboard::Keyboard::KEY_F5, SDLK_F5 },
{ love::keyboard::Keyboard::KEY_F6, SDLK_F6 },
{ love::keyboard::Keyboard::KEY_F7, SDLK_F7 },
{ love::keyboard::Keyboard::KEY_F8, SDLK_F8 },
{ love::keyboard::Keyboard::KEY_F9, SDLK_F9 },
{ love::keyboard::Keyboard::KEY_F10, SDLK_F10 },
{ love::keyboard::Keyboard::KEY_F11, SDLK_F11 },
{ love::keyboard::Keyboard::KEY_F12, SDLK_F12 },
{ love::keyboard::Keyboard::KEY_F13, SDLK_F13 },
{ love::keyboard::Keyboard::KEY_F14, SDLK_F14 },
{ love::keyboard::Keyboard::KEY_F15, SDLK_F15 },
{ love::keyboard::Keyboard::KEY_NUMLOCK, SDLK_NUMLOCK },
{ love::keyboard::Keyboard::KEY_CAPSLOCK, SDLK_CAPSLOCK },
{ love::keyboard::Keyboard::KEY_SCROLLOCK, SDLK_SCROLLOCK },
{ love::keyboard::Keyboard::KEY_RSHIFT, SDLK_RSHIFT },
{ love::keyboard::Keyboard::KEY_LSHIFT, SDLK_LSHIFT },
{ love::keyboard::Keyboard::KEY_RCTRL, SDLK_RCTRL },
{ love::keyboard::Keyboard::KEY_LCTRL, SDLK_LCTRL },
{ love::keyboard::Keyboard::KEY_RALT, SDLK_RALT },
{ love::keyboard::Keyboard::KEY_LALT, SDLK_LALT },
{ love::keyboard::Keyboard::KEY_RMETA, SDLK_RMETA },
{ love::keyboard::Keyboard::KEY_LMETA, SDLK_LMETA },
{ love::keyboard::Keyboard::KEY_LSUPER, SDLK_LSUPER },
{ love::keyboard::Keyboard::KEY_RSUPER, SDLK_RSUPER },
{ love::keyboard::Keyboard::KEY_MODE, SDLK_MODE },
{ love::keyboard::Keyboard::KEY_COMPOSE, SDLK_COMPOSE },
{ love::keyboard::Keyboard::KEY_HELP, SDLK_HELP },
{ love::keyboard::Keyboard::KEY_PRINT, SDLK_PRINT },
{ love::keyboard::Keyboard::KEY_SYSREQ, SDLK_SYSREQ },
{ love::keyboard::Keyboard::KEY_BREAK, SDLK_BREAK },
{ love::keyboard::Keyboard::KEY_MENU, SDLK_MENU },
{ love::keyboard::Keyboard::KEY_POWER, SDLK_POWER },
{ love::keyboard::Keyboard::KEY_EURO, SDLK_EURO },
{ love::keyboard::Keyboard::KEY_UNDO, SDLK_UNDO },
{ love::keyboard::Keyboard::KEY_UNKNOWN, SDLK_UNKNOWN },
};
EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM> Event::keys(Event::keyEntries, sizeof(Event::keyEntries));
EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry Event::buttonEntries[] =
{
{ love::mouse::Mouse::BUTTON_LEFT, SDL_BUTTON_LEFT},
{ love::mouse::Mouse::BUTTON_MIDDLE, SDL_BUTTON_MIDDLE},
{ love::mouse::Mouse::BUTTON_RIGHT, SDL_BUTTON_RIGHT},
{ love::mouse::Mouse::BUTTON_WHEELUP, SDL_BUTTON_WHEELUP},
{ love::mouse::Mouse::BUTTON_WHEELDOWN, SDL_BUTTON_WHEELDOWN},
{ love::mouse::Mouse::BUTTON_X1, SDL_BUTTON_X1},
{ love::mouse::Mouse::BUTTON_X2, SDL_BUTTON_X2},
};
EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM> Event::buttons(Event::buttonEntries, sizeof(Event::buttonEntries));
} // sdl
} // event
} // love
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Event.h"
#include "keyboard/Keyboard.h"
#include "mouse/Mouse.h"
namespace love
{
namespace event
{
namespace sdl
{
const char *Event::getName() const
{
return "love.event.sdl";
}
Event::Event()
{
SDL_EnableUNICODE(1);
}
void Event::pump()
{
SDL_PumpEvents();
static SDL_Event e;
SDL_EnableUNICODE(1);
Message *msg;
while (SDL_PollEvent(&e))
{
msg = convert(e);
if (msg)
{
push(msg);
msg->release();
}
}
}
Message *Event::wait()
{
static SDL_Event e;
bool ok = (SDL_WaitEvent(&e) == 1);
if (!ok)
return NULL;
return convert(e);
}
void Event::clear()
{
static SDL_Event e;
while (SDL_PollEvent(&e))
{
// Do nothing with 'e' ...
}
love::event::Event::clear();
}
Message *Event::convert(SDL_Event &e)
{
Message *msg = NULL;
love::keyboard::Keyboard::Key key;
love::mouse::Mouse::Button button;
Variant *arg1, *arg2, *arg3;
const char *txt;
switch (e.type)
{
case SDL_KEYDOWN:
if (keys.find(e.key.keysym.sym, key) && love::event::Event::keys.find(key, txt))
{
arg1 = new Variant(txt, strlen(txt));
arg2 = new Variant((double) e.key.keysym.unicode);
msg = new Message("keypressed", arg1, arg2);
arg1->release();
arg2->release();
}
break;
case SDL_KEYUP:
if (keys.find(e.key.keysym.sym, key) && love::event::Event::keys.find(key, txt))
{
arg1 = new Variant(txt, strlen(txt));
msg = new Message("keyreleased", arg1);
arg1->release();
}
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
if (buttons.find(e.button.button, button) && love::event::Event::buttons.find(button, txt))
{
arg1 = new Variant((double) e.button.x);
arg2 = new Variant((double) e.button.y);
arg3 = new Variant(txt, strlen(txt));
msg = new Message((e.type == SDL_MOUSEBUTTONDOWN) ?
"mousepressed" : "mousereleased",
arg1, arg2, arg3);
arg1->release();
arg2->release();
arg3->release();
}
break;
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
arg1 = new Variant((double)(e.jbutton.which+1));
arg2 = new Variant((double)(e.jbutton.button+1));
msg = new Message((e.type == SDL_JOYBUTTONDOWN) ?
"joystickpressed" : "joystickreleased",
arg1, arg2);
arg1->release();
arg2->release();
break;
case SDL_ACTIVEEVENT:
arg1 = new Variant(e.active.gain != 0);
if (e.active.state & SDL_APPINPUTFOCUS)
msg = new Message("focus", arg1);
arg1->release();
break;
case SDL_QUIT:
msg = new Message("quit");
break;
}
return msg;
}
EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry Event::keyEntries[] =
{
{ love::keyboard::Keyboard::KEY_BACKSPACE, SDLK_BACKSPACE},
{ love::keyboard::Keyboard::KEY_TAB, SDLK_TAB},
{ love::keyboard::Keyboard::KEY_CLEAR, SDLK_CLEAR},
{ love::keyboard::Keyboard::KEY_RETURN, SDLK_RETURN},
{ love::keyboard::Keyboard::KEY_PAUSE, SDLK_PAUSE},
{ love::keyboard::Keyboard::KEY_ESCAPE, SDLK_ESCAPE },
{ love::keyboard::Keyboard::KEY_SPACE, SDLK_SPACE },
{ love::keyboard::Keyboard::KEY_EXCLAIM, SDLK_EXCLAIM },
{ love::keyboard::Keyboard::KEY_QUOTEDBL, SDLK_QUOTEDBL },
{ love::keyboard::Keyboard::KEY_HASH, SDLK_HASH },
{ love::keyboard::Keyboard::KEY_DOLLAR, SDLK_DOLLAR },
{ love::keyboard::Keyboard::KEY_AMPERSAND, SDLK_AMPERSAND },
{ love::keyboard::Keyboard::KEY_QUOTE, SDLK_QUOTE },
{ love::keyboard::Keyboard::KEY_LEFTPAREN, SDLK_LEFTPAREN },
{ love::keyboard::Keyboard::KEY_RIGHTPAREN, SDLK_RIGHTPAREN },
{ love::keyboard::Keyboard::KEY_ASTERISK, SDLK_ASTERISK },
{ love::keyboard::Keyboard::KEY_PLUS, SDLK_PLUS },
{ love::keyboard::Keyboard::KEY_COMMA, SDLK_COMMA },
{ love::keyboard::Keyboard::KEY_MINUS, SDLK_MINUS },
{ love::keyboard::Keyboard::KEY_PERIOD, SDLK_PERIOD },
{ love::keyboard::Keyboard::KEY_SLASH, SDLK_SLASH },
{ love::keyboard::Keyboard::KEY_0, SDLK_0 },
{ love::keyboard::Keyboard::KEY_1, SDLK_1 },
{ love::keyboard::Keyboard::KEY_2, SDLK_2 },
{ love::keyboard::Keyboard::KEY_3, SDLK_3 },
{ love::keyboard::Keyboard::KEY_4, SDLK_4 },
{ love::keyboard::Keyboard::KEY_5, SDLK_5 },
{ love::keyboard::Keyboard::KEY_6, SDLK_6 },
{ love::keyboard::Keyboard::KEY_7, SDLK_7 },
{ love::keyboard::Keyboard::KEY_8, SDLK_8 },
{ love::keyboard::Keyboard::KEY_9, SDLK_9 },
{ love::keyboard::Keyboard::KEY_COLON, SDLK_COLON },
{ love::keyboard::Keyboard::KEY_SEMICOLON, SDLK_SEMICOLON },
{ love::keyboard::Keyboard::KEY_LESS, SDLK_LESS },
{ love::keyboard::Keyboard::KEY_EQUALS, SDLK_EQUALS },
{ love::keyboard::Keyboard::KEY_GREATER, SDLK_GREATER },
{ love::keyboard::Keyboard::KEY_QUESTION, SDLK_QUESTION },
{ love::keyboard::Keyboard::KEY_AT, SDLK_AT },
{ love::keyboard::Keyboard::KEY_LEFTBRACKET, SDLK_LEFTBRACKET },
{ love::keyboard::Keyboard::KEY_BACKSLASH, SDLK_BACKSLASH },
{ love::keyboard::Keyboard::KEY_RIGHTBRACKET, SDLK_RIGHTBRACKET },
{ love::keyboard::Keyboard::KEY_CARET, SDLK_CARET },
{ love::keyboard::Keyboard::KEY_UNDERSCORE, SDLK_UNDERSCORE },
{ love::keyboard::Keyboard::KEY_BACKQUOTE, SDLK_BACKQUOTE },
{ love::keyboard::Keyboard::KEY_A, SDLK_a },
{ love::keyboard::Keyboard::KEY_B, SDLK_b },
{ love::keyboard::Keyboard::KEY_C, SDLK_c },
{ love::keyboard::Keyboard::KEY_D, SDLK_d },
{ love::keyboard::Keyboard::KEY_E, SDLK_e },
{ love::keyboard::Keyboard::KEY_F, SDLK_f },
{ love::keyboard::Keyboard::KEY_G, SDLK_g },
{ love::keyboard::Keyboard::KEY_H, SDLK_h },
{ love::keyboard::Keyboard::KEY_I, SDLK_i },
{ love::keyboard::Keyboard::KEY_J, SDLK_j },
{ love::keyboard::Keyboard::KEY_K, SDLK_k },
{ love::keyboard::Keyboard::KEY_L, SDLK_l },
{ love::keyboard::Keyboard::KEY_M, SDLK_m },
{ love::keyboard::Keyboard::KEY_N, SDLK_n },
{ love::keyboard::Keyboard::KEY_O, SDLK_o },
{ love::keyboard::Keyboard::KEY_P, SDLK_p },
{ love::keyboard::Keyboard::KEY_Q, SDLK_q },
{ love::keyboard::Keyboard::KEY_R, SDLK_r },
{ love::keyboard::Keyboard::KEY_S, SDLK_s },
{ love::keyboard::Keyboard::KEY_T, SDLK_t },
{ love::keyboard::Keyboard::KEY_U, SDLK_u },
{ love::keyboard::Keyboard::KEY_V, SDLK_v },
{ love::keyboard::Keyboard::KEY_W, SDLK_w },
{ love::keyboard::Keyboard::KEY_X, SDLK_x },
{ love::keyboard::Keyboard::KEY_Y, SDLK_y },
{ love::keyboard::Keyboard::KEY_Z, SDLK_z },
{ love::keyboard::Keyboard::KEY_DELETE, SDLK_DELETE },
{ love::keyboard::Keyboard::KEY_KP0, SDLK_KP0 },
{ love::keyboard::Keyboard::KEY_KP1, SDLK_KP1 },
{ love::keyboard::Keyboard::KEY_KP2, SDLK_KP2 },
{ love::keyboard::Keyboard::KEY_KP3, SDLK_KP3 },
{ love::keyboard::Keyboard::KEY_KP4, SDLK_KP4 },
{ love::keyboard::Keyboard::KEY_KP5, SDLK_KP5 },
{ love::keyboard::Keyboard::KEY_KP6, SDLK_KP6 },
{ love::keyboard::Keyboard::KEY_KP7, SDLK_KP7 },
{ love::keyboard::Keyboard::KEY_KP8, SDLK_KP8 },
{ love::keyboard::Keyboard::KEY_KP9, SDLK_KP9 },
{ love::keyboard::Keyboard::KEY_KP_PERIOD, SDLK_KP_PERIOD },
{ love::keyboard::Keyboard::KEY_KP_DIVIDE, SDLK_KP_DIVIDE },
{ love::keyboard::Keyboard::KEY_KP_MULTIPLY, SDLK_KP_MULTIPLY},
{ love::keyboard::Keyboard::KEY_KP_MINUS, SDLK_KP_MINUS },
{ love::keyboard::Keyboard::KEY_KP_PLUS, SDLK_KP_PLUS },
{ love::keyboard::Keyboard::KEY_KP_ENTER, SDLK_KP_ENTER },
{ love::keyboard::Keyboard::KEY_KP_EQUALS, SDLK_KP_EQUALS },
{ love::keyboard::Keyboard::KEY_UP, SDLK_UP },
{ love::keyboard::Keyboard::KEY_DOWN, SDLK_DOWN },
{ love::keyboard::Keyboard::KEY_RIGHT, SDLK_RIGHT },
{ love::keyboard::Keyboard::KEY_LEFT, SDLK_LEFT },
{ love::keyboard::Keyboard::KEY_INSERT, SDLK_INSERT },
{ love::keyboard::Keyboard::KEY_HOME, SDLK_HOME },
{ love::keyboard::Keyboard::KEY_END, SDLK_END },
{ love::keyboard::Keyboard::KEY_PAGEUP, SDLK_PAGEUP },
{ love::keyboard::Keyboard::KEY_PAGEDOWN, SDLK_PAGEDOWN },
{ love::keyboard::Keyboard::KEY_F1, SDLK_F1 },
{ love::keyboard::Keyboard::KEY_F2, SDLK_F2 },
{ love::keyboard::Keyboard::KEY_F3, SDLK_F3 },
{ love::keyboard::Keyboard::KEY_F4, SDLK_F4 },
{ love::keyboard::Keyboard::KEY_F5, SDLK_F5 },
{ love::keyboard::Keyboard::KEY_F6, SDLK_F6 },
{ love::keyboard::Keyboard::KEY_F7, SDLK_F7 },
{ love::keyboard::Keyboard::KEY_F8, SDLK_F8 },
{ love::keyboard::Keyboard::KEY_F9, SDLK_F9 },
{ love::keyboard::Keyboard::KEY_F10, SDLK_F10 },
{ love::keyboard::Keyboard::KEY_F11, SDLK_F11 },
{ love::keyboard::Keyboard::KEY_F12, SDLK_F12 },
{ love::keyboard::Keyboard::KEY_F13, SDLK_F13 },
{ love::keyboard::Keyboard::KEY_F14, SDLK_F14 },
{ love::keyboard::Keyboard::KEY_F15, SDLK_F15 },
{ love::keyboard::Keyboard::KEY_NUMLOCK, SDLK_NUMLOCK },
{ love::keyboard::Keyboard::KEY_CAPSLOCK, SDLK_CAPSLOCK },
{ love::keyboard::Keyboard::KEY_SCROLLOCK, SDLK_SCROLLOCK },
{ love::keyboard::Keyboard::KEY_RSHIFT, SDLK_RSHIFT },
{ love::keyboard::Keyboard::KEY_LSHIFT, SDLK_LSHIFT },
{ love::keyboard::Keyboard::KEY_RCTRL, SDLK_RCTRL },
{ love::keyboard::Keyboard::KEY_LCTRL, SDLK_LCTRL },
{ love::keyboard::Keyboard::KEY_RALT, SDLK_RALT },
{ love::keyboard::Keyboard::KEY_LALT, SDLK_LALT },
{ love::keyboard::Keyboard::KEY_RMETA, SDLK_RMETA },
{ love::keyboard::Keyboard::KEY_LMETA, SDLK_LMETA },
{ love::keyboard::Keyboard::KEY_LSUPER, SDLK_LSUPER },
{ love::keyboard::Keyboard::KEY_RSUPER, SDLK_RSUPER },
{ love::keyboard::Keyboard::KEY_MODE, SDLK_MODE },
{ love::keyboard::Keyboard::KEY_COMPOSE, SDLK_COMPOSE },
{ love::keyboard::Keyboard::KEY_HELP, SDLK_HELP },
{ love::keyboard::Keyboard::KEY_PRINT, SDLK_PRINT },
{ love::keyboard::Keyboard::KEY_SYSREQ, SDLK_SYSREQ },
{ love::keyboard::Keyboard::KEY_BREAK, SDLK_BREAK },
{ love::keyboard::Keyboard::KEY_MENU, SDLK_MENU },
{ love::keyboard::Keyboard::KEY_POWER, SDLK_POWER },
{ love::keyboard::Keyboard::KEY_EURO, SDLK_EURO },
{ love::keyboard::Keyboard::KEY_UNDO, SDLK_UNDO },
{ love::keyboard::Keyboard::KEY_UNKNOWN, SDLK_UNKNOWN },
};
EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM> Event::keys(Event::keyEntries, sizeof(Event::keyEntries));
EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry Event::buttonEntries[] =
{
{ love::mouse::Mouse::BUTTON_LEFT, SDL_BUTTON_LEFT},
{ love::mouse::Mouse::BUTTON_MIDDLE, SDL_BUTTON_MIDDLE},
{ love::mouse::Mouse::BUTTON_RIGHT, SDL_BUTTON_RIGHT},
{ love::mouse::Mouse::BUTTON_WHEELUP, SDL_BUTTON_WHEELUP},
{ love::mouse::Mouse::BUTTON_WHEELDOWN, SDL_BUTTON_WHEELDOWN},
{ love::mouse::Mouse::BUTTON_X1, SDL_BUTTON_X1},
{ love::mouse::Mouse::BUTTON_X2, SDL_BUTTON_X2},
};
EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM> Event::buttons(Event::buttonEntries, sizeof(Event::buttonEntries));
} // sdl
} // event
} // love
+82 -82
View File
@@ -1,82 +1,82 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_EVENT_SDL_EVENT_H
#define LOVE_EVENT_SDL_EVENT_H
// LOVE
#include "event/Event.h"
#include "common/runtime.h"
#include "common/EnumMap.h"
// SDL
#include <SDL.h>
namespace love
{
namespace event
{
namespace sdl
{
class Event : public love::event::Event
{
public:
// Implements Module.
const char *getName() const;
Event();
/**
* Pumps the event queue. This function gathers all the pending input information
* from devices and places it on the event queue. Normally not needed if you poll
* for events.
**/
void pump();
/**
* Waits for the next event (indefinitely). Useful for creating games where
* the screen and game state only needs updating when the user interacts with
* the window.
**/
Message *wait();
/**
* Clears the event queue.
*/
void clear();
private:
Message *convert(SDL_Event &e);
static EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry keyEntries[];
static EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM> keys;
static EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry buttonEntries[];
static EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM> buttons;
}; // System
} // sdl
} // event
} // love
#endif // LOVE_EVENT_SDL_EVENT_H
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_EVENT_SDL_EVENT_H
#define LOVE_EVENT_SDL_EVENT_H
// LOVE
#include "event/Event.h"
#include "common/runtime.h"
#include "common/EnumMap.h"
// SDL
#include <SDL.h>
namespace love
{
namespace event
{
namespace sdl
{
class Event : public love::event::Event
{
public:
// Implements Module.
const char *getName() const;
Event();
/**
* Pumps the event queue. This function gathers all the pending input information
* from devices and places it on the event queue. Normally not needed if you poll
* for events.
**/
void pump();
/**
* Waits for the next event (indefinitely). Useful for creating games where
* the screen and game state only needs updating when the user interacts with
* the window.
**/
Message *wait();
/**
* Clears the event queue.
*/
void clear();
private:
Message *convert(SDL_Event &e);
static EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM>::Entry keyEntries[];
static EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM> keys;
static EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM>::Entry buttonEntries[];
static EnumMap<love::mouse::Mouse::Button, Uint8, love::mouse::Mouse::BUTTON_MAX_ENUM> buttons;
}; // System
} // sdl
} // event
} // love
#endif // LOVE_EVENT_SDL_EVENT_H
+150 -150
View File
@@ -1,150 +1,150 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "wrap_Event.h"
// LOVE
#include "common/runtime.h"
// sdlevent
#include "Event.h"
namespace love
{
namespace event
{
namespace sdl
{
static Event *instance = 0;
static int poll_i(lua_State *L)
{
Message *m;
while (instance->poll(m))
{
int args = m->toLua(L);
m->release();
return args;
}
// No pending events.
return 0;
}
int w_pump(lua_State *)
{
instance->pump();
return 0;
}
int w_poll(lua_State *L)
{
lua_pushcclosure(L, &poll_i, 0);
return 1;
}
int w_wait(lua_State *L)
{
static Message *m;
if ((m = instance->wait()))
{
int args = m->toLua(L);
m->release();
return args;
}
return 0;
}
int w_push(lua_State *L)
{
static Message *m;
bool success = (m = Message::fromLua(L, 1)) != NULL;
luax_pushboolean(L, success);
if (!success)
return 1;
instance->push(m);
m->release();
return 1;
}
int w_clear(lua_State *)
{
instance->clear();
return 0;
}
int w_quit(lua_State *L)
{
Message *m = new Message("quit");
instance->push(m);
m->release();
luax_pushboolean(L, true);
return 1;
}
// List of functions to wrap.
static const luaL_Reg functions[] =
{
{ "pump", w_pump },
{ "poll", w_poll },
{ "wait", w_wait },
{ "push", w_push },
{ "clear", w_clear },
{ "quit", w_quit },
{ 0, 0 }
};
extern "C" int luaopen_love_event(lua_State *L)
{
if (instance == 0)
{
try
{
instance = new Event();
}
catch(Exception &e)
{
return luaL_error(L, e.what());
}
}
else
instance->retain();
WrappedModule w;
w.module = instance;
w.name = "event";
w.flags = MODULE_T;
w.functions = functions;
w.types = 0;
return luax_register_module(L, w);
}
} // sdl
} // event
} // love
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "wrap_Event.h"
// LOVE
#include "common/runtime.h"
// sdlevent
#include "Event.h"
namespace love
{
namespace event
{
namespace sdl
{
static Event *instance = 0;
static int poll_i(lua_State *L)
{
Message *m;
while (instance->poll(m))
{
int args = m->toLua(L);
m->release();
return args;
}
// No pending events.
return 0;
}
int w_pump(lua_State *)
{
instance->pump();
return 0;
}
int w_poll(lua_State *L)
{
lua_pushcclosure(L, &poll_i, 0);
return 1;
}
int w_wait(lua_State *L)
{
static Message *m;
if ((m = instance->wait()))
{
int args = m->toLua(L);
m->release();
return args;
}
return 0;
}
int w_push(lua_State *L)
{
static Message *m;
bool success = (m = Message::fromLua(L, 1)) != NULL;
luax_pushboolean(L, success);
if (!success)
return 1;
instance->push(m);
m->release();
return 1;
}
int w_clear(lua_State *)
{
instance->clear();
return 0;
}
int w_quit(lua_State *L)
{
Message *m = new Message("quit");
instance->push(m);
m->release();
luax_pushboolean(L, true);
return 1;
}
// List of functions to wrap.
static const luaL_Reg functions[] =
{
{ "pump", w_pump },
{ "poll", w_poll },
{ "wait", w_wait },
{ "push", w_push },
{ "clear", w_clear },
{ "quit", w_quit },
{ 0, 0 }
};
extern "C" int luaopen_love_event(lua_State *L)
{
if (instance == 0)
{
try
{
instance = new Event();
}
catch(Exception &e)
{
return luaL_error(L, e.what());
}
}
else
instance->retain();
WrappedModule w;
w.module = instance;
w.name = "event";
w.flags = MODULE_T;
w.functions = functions;
w.types = 0;
return luax_register_module(L, w);
}
} // sdl
} // event
} // love
+48 -48
View File
@@ -1,48 +1,48 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_EVENT_SDL_WRAP_EVENT_H
#define LOVE_EVENT_SDL_WRAP_EVENT_H
// LOVE
#include "common/config.h"
#include "Event.h"
namespace love
{
namespace event
{
namespace sdl
{
int w_pump(lua_State *L);
int w_poll(lua_State *L);
int w_wait(lua_State *L);
int w_push(lua_State *L);
int w_clear(lua_State *L);
int w_quit(lua_State *L);
extern "C" LOVE_EXPORT int luaopen_love_event(lua_State *L);
} // sdl
} // event
} // love
#endif // LOVE_EVENT_SDL_WRAP_EVENT_H
/**
* Copyright (c) 2006-2012 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_EVENT_SDL_WRAP_EVENT_H
#define LOVE_EVENT_SDL_WRAP_EVENT_H
// LOVE
#include "common/config.h"
#include "Event.h"
namespace love
{
namespace event
{
namespace sdl
{
int w_pump(lua_State *L);
int w_poll(lua_State *L);
int w_wait(lua_State *L);
int w_push(lua_State *L);
int w_clear(lua_State *L);
int w_quit(lua_State *L);
extern "C" LOVE_EXPORT int luaopen_love_event(lua_State *L);
} // sdl
} // event
} // love
#endif // LOVE_EVENT_SDL_WRAP_EVENT_H