SDL: new API SDL_ANDROID_SetAndroidKeycode() to set SDL keycodes to Volume keys and other hardware keys.

This commit is contained in:
Sergii Pylypenko
2015-07-31 21:47:09 +03:00
parent 4eced8345f
commit b205003403
2 changed files with 12 additions and 0 deletions

View File

@@ -145,6 +145,11 @@ extern DECLSPEC int SDLCALL SDL_IsScreenKeyboardShown(void *unused);
On OUYA: O = A, U = X, Y = Y, A = B */
extern DECLSPEC void SDLCALL SDL_ANDROID_SetGamepadKeymap(int A, int B, int X, int Y, int L1, int R1, int L2, int R2, int LThumb, int RThumb);
/* Set SDL keycode for hardware Android key. Android keycodes are defined here:
http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_0
KEYCODE_VOLUME_UP = 24, KEYCODE_VOLUME_DOWN = 25, KEYCODE_BACK = 4 */
extern DECLSPEC void SDLCALL SDL_ANDROID_SetAndroidKeycode(int Android_Key, int Sdl_Key);
/* Copy contents of Android clipboard into supplied buffer */
extern DECLSPEC void SDLCALL SDL_ANDROID_GetClipboardText(char * buf, int len);

View File

@@ -1682,6 +1682,13 @@ void SDL_ANDROID_SetGamepadKeymap(int A, int B, int X, int Y, int L1, int R1, in
if (RThumb) SDL_android_keymap[KEYCODE_BUTTON_THUMBR] = RThumb;
}
void SDL_ANDROID_SetAndroidKeycode(int Android_Key, int Sdl_Key)
{
if (Android_Key < 0 || Android_Key >= KEYCODE_LAST)
return;
SDL_android_keymap[Android_Key] = Sdl_Key;
}
void *mouseClickTimeoutThread (void * unused)
{
struct timespec ts;