Fixed bug in love.event. Started on error screen.

This commit is contained in:
rude
2009-08-20 22:58:25 +02:00
parent a31ada3b48
commit ae8d660868
3 changed files with 53 additions and 7 deletions
+16 -3
View File
@@ -44,9 +44,8 @@ namespace sdl
int Event::wait(lua_State * L)
{
static SDL_Event e;
SDL_WaitEvent(&e);
return pushEvent(L, e);
lua_pushcclosure(L, &wait_i, 0);
return 1;
}
void Event::quit()
@@ -83,6 +82,20 @@ namespace sdl
return 0;
}
int Event::wait_i(lua_State * L)
{
SDL_EnableUNICODE(1);
// The union used to get SDL events.
static SDL_Event e;
SDL_WaitEvent(&e);
int args = Event::pushEvent(L, e);
return args;
}
int Event::pushEvent(lua_State * L, SDL_Event & e)
{
switch(e.type)