Added preliminary keyboard event support
This commit is contained in:
parent
26a7c00433
commit
d8e077adbb
7 changed files with 112 additions and 19 deletions
|
@ -30,6 +30,24 @@
|
|||
#include "../../events/SDL_sysevents.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
#include "SDL_androidevents.h"
|
||||
|
||||
void Android_InitEvents(){
|
||||
|
||||
SDL_Keyboard keyboard;
|
||||
|
||||
SDL_zero(keyboard);
|
||||
SDL_AddKeyboard(&keyboard, -1);
|
||||
|
||||
SDLKey keymap[SDL_NUM_SCANCODES];
|
||||
|
||||
/* Add default scancode to key mapping */
|
||||
SDL_GetDefaultKeymap(keymap);
|
||||
SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Android_PumpEvents(_THIS)
|
||||
{
|
||||
|
@ -49,4 +67,14 @@ Android_PumpEvents(_THIS)
|
|||
*/
|
||||
}
|
||||
|
||||
int
|
||||
Android_OnKeyDown(int keycode){
|
||||
return SDL_SendKeyboardKey(0, SDL_PRESSED, (SDL_scancode)keycode);
|
||||
}
|
||||
|
||||
int
|
||||
Android_OnKeyUp(int keycode){
|
||||
return SDL_SendKeyboardKey(0, SDL_RELEASED, (SDL_scancode)keycode);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue