Regarding the DPAD KeyCodes (KEYCODE_DPAD_RIGHT, KEYCODE_DPAD_LEFT, KEYCODE_DPAD_UP and KEYCODE_DPAD_DOWN), if I have both a physical keyboard and a physical game controller plugged-in at the same time, Activity_KeyPress(KeyCode As Int) will get the same KeyCode value.
In other words, pressing DOWN on the keyboard or pressing DOWN on the gamepad will always yield the same result, which is NOT what I want.
Here's what I need:
Can anyone help me wrire a "getButtonPressSource" method?
Many many thanks in advance!
In other words, pressing DOWN on the keyboard or pressing DOWN on the gamepad will always yield the same result, which is NOT what I want.
Here's what I need:
B4X:
Sub Activity_KeyPress(KeyCode As Int) As Boolean
Select KeyCode
Case KeyCodes.KEYCODE_DPAD_DOWN
Log("The DOWN key was pressed by the user, but on which device?")
Select getKeyPressSource '<-- This is the magical function that I need!!!!!!!!
Case KEYBOARD
Log("The key was pressed on physical keyboard")
Exit
Case GAMEPAD
Log("The key was pressed on the physical gamepad")
Exit
Case Else
Log("The key was pressed on an unknown device")
Exit
End Select
...
...
...
...
Can anyone help me wrire a "getButtonPressSource" method?
Many many thanks in advance!
Last edited: