[rcore] Fixed bug in hovering and input for android#4947
[rcore] Fixed bug in hovering and input for android#4947raysan5 merged 2 commits intoraysan5:masterfrom
Conversation
Bug Fix Update Code to Ignore Hovering Inputs Completely
|
@padmadevd Mmmh... I was not aware of that possible input state... Please, first of all, could you review code conventions: https://github.com/raysan5/raylib/blob/master/CONVENTIONS.md |
corrected coding conventions.
|
i really apologize for the mistake. |
|
@padmadevd thanks! It looks good to me. Merging. |
|
i previously implemented a bool array of size 32 to store the hover state of the pointers. Because, chat GPT told me that the pointer ID returned by AMotionEvent_getPointerId(event, i) will be in the range of 0 to 31. Is it true? |
raylib treats both touch and hover events as same in android platform. This causes problem with android devices with pen or stylus support.
IsMouseButtonPressed() and IsMouseButtonDown() are triggered just for hovering above the screen with stylus. And IsMouseButtonReleased() is not triggered. meaning, the mouse is always down. Because, raylib not check AMOTION_EVENT_ACTION_HOVER_EXIT to release the input.
So this PR adds code to ignore the Hovering Input completely.
The Code is Tested in my samsung A13 phone. It does not have pen or stylus support. But i used Genymobile/scrcpy to emulate hovering input.
The hovering is ignored successfully and in my phone it works perfectly without any side effects to other inputs.
I already tested another version of the code in my own game in a samsung tablet with stylus. But this new version is not tested in real device.