Moving Two Fingers on Screen on Mobile Triggers ESC Button

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Soule X
Red Slime
Posts: 86
Joined: Wed Sep 19, 2012 4:18 pm
Location: Indianapolis

Moving Two Fingers on Screen on Mobile Triggers ESC Button

Post by Soule X »

Is there any way to disable this? I know the engine doesn't allow simultaneous touchscreen motions, but for some reason it triggers the ESC key to be pressed. My concern is that it can be done on accident. For example, if a player is resting part of the hand on the screen unintentionally and swipes it could exit the game.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

This is news to me

Double-tongued on mobile is supposed to do a right-click, not an ESC
User avatar
Soule X
Red Slime
Posts: 86
Joined: Wed Sep 19, 2012 4:18 pm
Location: Indianapolis

Post by Soule X »

It was news to me, too, until I accidentally did it today.
I tried it on some of the games on the play store to be sure and it seems to do it on those as well.
Easiest way to replicate it is to do the pinch motion.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Bob the Hamster wrote:Double-tongued on mobile
I think you typed this on mobile... I don't think you could do multi-touch with your tongue!

Unfortunately I don't have a multitouch phone, so can't test this. Luckily, the Android emulator somewhat recently added the ability to simulate multitouch events, by forwarding touches from an app running on a tethered phone. Unfortunately I don't have a multitouch phone.
Last edited by TMC on Wed Mar 29, 2017 9:59 am, edited 2 times in total.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Oh, autocorrect, you always makeup​ me smiles

By lucky coincidence, yesterday I submitted "OHRRPGCE Input Test" to the app store.

I could only make this happen with two-fingers when swiping quickly and rapidly upward. However, swiping with three fingers reproduced it very consistently. It was almost always the Android "Menu" button, which is mapped to ESC by default. Sometimes I could also get it to do the "Back" button, but only randomly. Back is also mapped to ESC

I'll have to do some more research to figure out if this is an Android feature or an sdl-android feature
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6461
Joined: Mon Dec 08, 2008 7:07 am
Contact:

Post by Spoonweaver »

It occurs to me that both tmc and bob James have mentioned a few times that the lack of access to certain devices has held up ohr development.

I frequent garage sales that sell these types of devices regularly for about a dollar. So if you have some sort of list of devices you'd need for testing, I could keep an eye out. I doubt I'll be able to find a new iphone7 but I've seen several droids and iPod touches. Also I don't think the shipping to either of you will be too bad and I would be glad to do it if it helps ohr development.
User avatar
Soule X
Red Slime
Posts: 86
Joined: Wed Sep 19, 2012 4:18 pm
Location: Indianapolis

Post by Soule X »

Messing around with the Input Test app on my Droid Turbo 2 I found that pinching with 2 fingers triggers "Back" without fail. Putting three fingers on the screen at once and moving them triggers "Main" most of the time or "Back" depending on the motions. That's less concerning to me as you have to really try to do it.

EDIT: Actually trying a few more things I discovered if you place one finger on the screen and swipe the other finger right it triggers "Main" and if you swipe left it triggers "Back."
This works 100% of the time.
Last edited by Soule X on Wed Mar 29, 2017 10:08 pm, edited 1 time in total.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

I have a few android devices laying around that I can test with thanks to work, so I don't have a shortage of those.

I do love the idea of getting a newer-than-2010 android device into tmc's hands, and would gladly chip in for the shipping :)

Thanks for the testing Soule X! I can reproduce what you describe.

I'll bet my 3-finger mashing was just confusing whatever gesture-recognition system does this feature.

When I build the apk file, I can override the menu/back buttons to do something other than ESC by editing a config file, so if you are working on a game for android that is messed up by these, I can make an apk for you that remaps these to some other harmless keys.

I think ESC makes a good default for these buttons in most ohrrpgce games, but obviously not for a game that has mouse/touch controls.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Hmm, sdl_android does have a bunch of code for multitouch in Video.java. I don't really know what it does, it seems like it's just forwarding events to DemoGLSurfaceView_nativeMotionEvent, in project/jni/sdl-1.2/src/video/android/SDL_androidinput.c. Ah ha, in that file is the code for recognising multitouch gestures. Wow, not the sort of code you want to figure out. But it seems that it reads the keycodes to generate from the multitouchGestureKeycode array, equal to SDL_ANDROID_SCREENKB_KEYCODE_[6-9]. And you can see that in SDL_androidinput.h that these are #defined to SDL_ANDROID_KEYCODE_{4,5,8,9}. Looking in keymap.c, 4,5 are LCTRL and ESCAPE (and also used as KEYCODE_MENU, KEYCODE_BACK), while 8,9 are LALT and RALT. These don't seem to be directly affected by AndroidAppSettings.cfg, but maybe there's another layer of remapping that occurs. But what does the 'AppUsesMultitouch' setting in the .cfg file do?
I frequent garage sales that sell these types of devices regularly for about a dollar.
Cool! Obscure android hardware and consoles like the FireTV need testing, but realistically, most of the consoels were released fairly recently so probably won't be found for $1.

I should probably get my hands on a gamepad, or even better, multiple gamepads since the code for that is clearly nonsense and needs to be rewritten. (I think James has a gamepad?) Not buying one is just laziness on my part. Recently I tried using my joystick emulator but it had mysteriously stopped working, and it was impossible to actually play anything with it anyway.
An iPod Touch would be ideal for porting to iOS, but even old models don't seem to be that cheap here. However I don't really want to start on an iOS port soon, I don't think it's a high priority.

I really should buy a new cellphone. But I've only had mine five years; a computer should last at least five years!
Last edited by TMC on Wed Mar 29, 2017 10:44 pm, edited 2 times in total.
Post Reply