Fire button in OpenArena will not toggle other buttons if you slide finger to them

This commit is contained in:
pelya
2013-05-04 17:44:36 +00:00
parent 4f742e3e82
commit dedefbf9a9
5 changed files with 20 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ AppUsesMultitouch=y
AppRecordsAudio=n
NonBlockingSwapBuffers=n
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
AppTouchscreenKeyboardKeysAmount=1
AppTouchscreenKeyboardKeysAmount=4
AppTouchscreenKeyboardKeysAmountAutoFire=0
RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9"
RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9"

View File

@@ -562,6 +562,8 @@ int main(int argc, char* argv[])
SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r);
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w);
}
//SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1);
//SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 1);
while(1)
{

View File

@@ -44,7 +44,7 @@
// TODO: this code is a HUGE MESS
enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM-1, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, BUTTON_ARROWS = MAX_BUTTONS } ; // Max amount of custom buttons
enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM-1, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, BUTTON_ARROWS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD } ; // Max amount of custom buttons
int SDL_ANDROID_isTouchscreenKeyboardUsed = 0;
static short touchscreenKeyboardTheme = 0;
@@ -56,7 +56,7 @@ static float transparency = 128.0f/255.0f;
static SDL_Rect arrows, arrowsExtended, buttons[MAX_BUTTONS], buttonsAutoFireRect[MAX_BUTTONS_AUTOFIRE];
static SDL_Rect arrowsDraw, buttonsDraw[MAX_BUTTONS];
static SDLKey buttonKeysyms[MAX_BUTTONS] = {
static SDLKey buttonKeysyms[MAX_BUTTONS] = {
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_0)),
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_1)),
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2)),
@@ -535,7 +535,19 @@ unsigned SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int po
if( action == MOUSE_MOVE )
{
// Process cases when pointer enters button area (it won't send keypress twice if button already pressed)
processed |= SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId);
int processOtherButtons = 1;
for( i = 0; i < MAX_BUTTONS; i++ )
{
if( buttonsGenerateSdlEvents[i] && pointerInButtonRect[i] == pointerId )
{
processOtherButtons = 0;
break;
}
}
if( processOtherButtons )
{
processed |= SDL_ANDROID_processTouchscreenKeyboard(x, y, MOUSE_DOWN, pointerId);
}
// Process cases when pointer leaves button area
// TODO: huge code size, split it or somehow make it more readable