diff --git a/Sources/nCine/Backends/Android/AndroidInputManager.cpp b/Sources/nCine/Backends/Android/AndroidInputManager.cpp index a1d47973..2fb10159 100644 --- a/Sources/nCine/Backends/Android/AndroidInputManager.cpp +++ b/Sources/nCine/Backends/Android/AndroidInputManager.cpp @@ -419,7 +419,7 @@ namespace nCine } keyboardEvent_.scancode = AKeyEvent_getScanCode(event); - keyboardEvent_.sym = AndroidKeys::keySymValueToEnum(AKeyEvent_getKeyCode(event)); + keyboardEvent_.sym = AndroidKeys::keySymValueToEnum(keyCode); keyboardEvent_.mod = AndroidKeys::keyModMaskToEnumMask(AKeyEvent_getMetaState(event)); const unsigned int keySym = static_cast(keyboardEvent_.sym); @@ -428,15 +428,18 @@ namespace nCine if (keyboardEvent_.sym != KeySym::UNKNOWN) { keyboardState_.keys_[keySym] = 1; } + LOGW("ANDROIDKEY DOWN: %i | %i | %i", keyCode, keyboardEvent_.sym, keyboardEvent_.mod); inputEventHandler_->OnKeyPressed(keyboardEvent_); break; case AKEY_EVENT_ACTION_UP: if (keyboardEvent_.sym != KeySym::UNKNOWN) { keyboardState_.keys_[keySym] = 0; } + LOGW("ANDROIDKEY DOWN: %i | %i | %i", keyCode, keyboardEvent_.sym, keyboardEvent_.mod); inputEventHandler_->OnKeyReleased(keyboardEvent_); break; case AKEY_EVENT_ACTION_MULTIPLE: + LOGW("ANDROIDKEY MULTIPLE: %i | %i | %i", keyCode, keyboardEvent_.sym, keyboardEvent_.mod); inputEventHandler_->OnKeyPressed(keyboardEvent_); break; } @@ -450,6 +453,10 @@ namespace nCine if (textInputEvent_.length > 0) { inputEventHandler_->OnTextInput(textInputEvent_); } + LOGW("ANDROIDKEY TEXT 1: %i | %i | %s", keyCode, unicodeKey, String(textInputEvent_.text, textInputEvent_.length).data()); + } else { + const int unicodeKey = keyEvent.getUnicodeChar(AKeyEvent_getMetaState(event)); + LOGW("ANDROIDKEY TEXT 2: %i | %i", keyCode, unicodeKey); } } diff --git a/Sources/nCine/Backends/Android/AndroidInputManager.h b/Sources/nCine/Backends/Android/AndroidInputManager.h index f781a8e5..40f8350a 100644 --- a/Sources/nCine/Backends/Android/AndroidInputManager.h +++ b/Sources/nCine/Backends/Android/AndroidInputManager.h @@ -131,6 +131,8 @@ namespace nCine /// The class for parsing and dispatching Android input events class AndroidInputManager : public IInputManager { + friend class AndroidApplication; + public: explicit AndroidInputManager(struct android_app* state); ~AndroidInputManager() override; @@ -222,9 +224,6 @@ namespace nCine static int findJoyId(int deviceId); static bool isDeviceConnected(int deviceId); static void deviceInfo(int deviceId, int joyId); - - /// To update joystick connections in `AndroidApplication::androidMain()` - friend class AndroidApplication; }; }