Fix for on-screen keymapping dialog, it's still buggy yet

This commit is contained in:
pelya
2010-12-20 11:18:27 +00:00
parent eef775dfcb
commit e34e40f4c1
3 changed files with 15 additions and 4 deletions

View File

@@ -1329,6 +1329,7 @@ JAVA_EXPORT_NAME(Settings_nativeGetKeymapKeyScreenKb) ( JNIEnv* env, jobject th
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetKeymapKeyScreenKb) ( JNIEnv* env, jobject thiz, jint keynum, jint key)
{
__android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeSetKeymapKeyScreenKb(): %d %d", keynum, key);
if( keynum < 0 || keynum > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 + 4 )
return;
@@ -1340,6 +1341,7 @@ JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetScreenKbKeyUsed) ( JNIEnv* env, jobject thiz, jint keynum, jint used)
{
SDL_Rect rect = {0, 0, 0, 0};
__android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeSetScreenKbKeyUsed(): %d %d", keynum, used);
int key = -1;
if( keynum == 0 )
key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD;

View File

@@ -649,7 +649,7 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
int i, ii;
int nbuttons1row, nbuttons2row;
touchscreenKeyboardTheme = theme;
if( _nbuttons > MAX_BUTTONS )
if( _nbuttons >= MAX_BUTTONS )
_nbuttons = MAX_BUTTONS;
AutoFireButtonsNum = nbuttonsAutoFire;
if( AutoFireButtonsNum > MAX_BUTTONS_AUTOFIRE )
@@ -736,6 +736,8 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
buttons[6].h = SDL_ANDROID_sWindowHeight/10;
}
for( i = 0; i < MAX_BUTTONS; i++ )
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboard(): button %d pos %d %d %d %d", i, (int)buttons[i].x, (int)buttons[i].y, (int)buttons[i].w, (int)buttons[i].h);
if( !showArrows )
{
arrows.w = 0;
@@ -761,6 +763,8 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
buttonsAutoFireRect[i].x = buttons[i].x - buttons[i].w / 2;
buttonsAutoFireRect[i].y = buttons[i].y - buttons[i].h / 2;
}
for( i = 0; i < MAX_BUTTONS; i++ )
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboard() 2: button %d pos %d %d %d %d", i, (int)buttons[i].x, (int)buttons[i].y, (int)buttons[i].w, (int)buttons[i].h);
};
@@ -855,6 +859,7 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
if( buttonId == SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD )
{
arrows = *pos;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SetScreenKeyboardButtonPos(): arrows %dx%d-%dx%d", (int)pos->x, (int)pos->y, (int)pos->w, (int)pos->h);
if(touchscreenKeyboardTheme == 0)
{
prepareFontCharWireframe(FONT_LEFT, arrows.w / 2, arrows.h / 2);
@@ -866,6 +871,7 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
else
{
buttons[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = *pos;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SetScreenKeyboardButtonPos(): button %d %dx%d-%dx%d", buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, (int)pos->x, (int)pos->y, (int)pos->w, (int)pos->h);
if(touchscreenKeyboardTheme == 0)
{
int i = buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0;
@@ -895,6 +901,7 @@ int SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, SDLKey key)
{
if( buttonId < SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 || ! key )
return 0;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SetScreenKeyboardButtonKey(): %d %d", buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, key);
buttonKeysyms[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = key;
return 1;
};