[client] app: move SDL key event handling out of main.c

This commit is contained in:
Tudor Brindus 2021-01-17 21:22:41 -05:00 committed by Geoffrey McRae
parent 7c9b273f70
commit 36b70779b9
2 changed files with 14 additions and 17 deletions

View File

@ -109,6 +109,20 @@ static bool sdlEventFilter(SDL_Event * event)
return true; return true;
} }
case SDL_KEYDOWN:
{
SDL_Scancode sc = event->key.keysym.scancode;
app_handleKeyPress(sc);
break;
}
case SDL_KEYUP:
{
SDL_Scancode sc = event->key.keysym.scancode;
app_handleKeyRelease(sc);
break;
}
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
switch(event->window.event) switch(event->window.event)
{ {

View File

@ -1455,23 +1455,6 @@ int eventFilter(void * userdata, SDL_Event * event)
return 0; return 0;
} }
switch(event->type)
{
case SDL_KEYDOWN:
{
SDL_Scancode sc = event->key.keysym.scancode;
app_handleKeyPress(sc);
break;
}
case SDL_KEYUP:
{
SDL_Scancode sc = event->key.keysym.scancode;
app_handleKeyRelease(sc);
break;
}
}
// consume all events // consume all events
return 0; return 0;
} }