SOLVED virtual keys problem GMS_2.3 (work on windows, didn't work on android)

F

formico2

Guest
Hi,
I'm new here. Sorry for my bad english.

Can't find the solution to a problem:
on-screen keys work fine on windows version, but don't work on android version.
Please help)

_______________
Decision: If you are making a Android game - remove all the code for gamepad
_______________

Code:
 virtual_key_show
Code show keys in the right place on both windows and android.

No errors displayed in the "Error List"
(ok, one error:
Code:
 Audio group 1 -> Loading...
Total memory used = 25146140(0x017fb31c) bytes
**********************************.
Entering main loop.
**********************************.
Audio group 1 -> Loaded
but I think it does not affect).

My project is port from GMS 1.4 to 2.3. On GMS 1.4 android-version keys didn't work well on some devices (stop working if minimize game and back to it).

Android settings:
1.jpg
2.jpg

Thanks
 
Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
When you say "don't work" how do you know? How are you creating the keys? How are you rendering them? Keep in mind that VKs depend on the GUI layer, and so you may be positioning them off-screen when it comes to android, or you may be checking room coords rather than GUI coords. The images you have posted I'm afraid don't help us debug the issue, but rather we need to see the entire code setup, and also know what size the GUI layer is on both target platforms.
 
F

formico2

Guest
When you say "don't work" how do you know? How are you creating the keys? How are you rendering them? Keep in mind that VKs depend on the GUI layer, and so you may be positioning them off-screen when it comes to android, or you may be checking room coords rather than GUI coords. The images you have posted I'm afraid don't help us debug the issue, but rather we need to see the entire code setup, and also know what size the GUI layer is on both target platforms.
Thank you for the answer.

Sorry, may be I don't understand completly)

I have this code in create event obj_menu

Code:
left = virtual_key_add (0, 52, 64,64, vk_left);
right = virtual_key_add (0, 116, 64,64, vk_right);
action = virtual_key_add (256, 116, 64,64, vk_space);
virtual_key_show(left);
virtual_key_show(right);
virtual_key_show(action);
Keys are shows in android versions apk by "virtual_key_show", but touch don't worked (worked perfect on windows version clicking by mouse on keys)

//sorry for my bad english)
 
Last edited by a moderator:
F

formico2

Guest
Please, if anyone finds a solution, write here.
Or maybe someone has the same problem write here. Together we will try to find a solution)
I'm keep a screenshot here to show that the keys are drawn, but touch doesn't work on Android (but works fine on Windows).
screenshot2.jpg
//sorry for my bad english)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
How are you checking for the keypress? Through code or using the events? If it's the events, then test using code, if it's though code then test using the events... either way it SHOULD work, but it'd be good to check and see if one works and the other doesn't and vice-versa.
 
F

formico2

Guest
Nocturne, thank you very very much!!
You helped me understand, thanks.

For everyone: If you are making a script with Android control - be sure to remove all the code for your gamepad
I deleted everything and left only the keyboard and finally it worked))
And yes, I tested my game for Android on a desktop with a gamepad))
//sorry for my bad english)
 
Top