Simplify code a bit
This commit is contained in:
parent
9e93915107
commit
44c18cb683
|
|
@ -80,8 +80,8 @@ static PlatformData platform = { 0 }; // Platform specific data
|
|||
//----------------------------------------------------------------------------------
|
||||
// Local Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
#define SCANCODE_MAPPED_NUM 162
|
||||
static const KeyboardKey ScancodeToKey[SCANCODE_MAPPED_NUM] = {
|
||||
#define KEYCODE_MAPPED_NUM 162
|
||||
static const KeyboardKey KeycodeMap[KEYCODE_MAPPED_NUM] = {
|
||||
KEY_NULL, // AKEYCODE_UNKNOWN
|
||||
0, // AKEYCODE_SOFT_LEFT
|
||||
0, // AKEYCODE_SOFT_RIGHT
|
||||
|
|
@ -1185,12 +1185,8 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
return 1; // Handled gamepad button
|
||||
}
|
||||
|
||||
KeyboardKey key = KEY_NULL;
|
||||
if (keycode > 0 && keycode < SCANCODE_MAPPED_NUM)
|
||||
{
|
||||
key = ScancodeToKey[keycode];
|
||||
|
||||
if (key > 0)
|
||||
KeyboardKey key = (keycode > 0 && keycode < KEYCODE_MAPPED_NUM) ? KeycodeMap[keycode] : KEY_NULL;
|
||||
if (key != KEY_NULL)
|
||||
{
|
||||
// Save current key and its state
|
||||
// NOTE: Android key action is 0 for down and 1 for up
|
||||
|
|
@ -1204,7 +1200,6 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
else if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_MULTIPLE) CORE.Input.Keyboard.keyRepeatInFrame[key] = 1;
|
||||
else CORE.Input.Keyboard.currentKeyState[key] = 0; // Key up
|
||||
}
|
||||
}
|
||||
|
||||
if (keycode == AKEYCODE_POWER)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user