mirror of https://github.com/axmolengine/axmol.git
Make KEY_SHIFT equal to KEY_LEFT_SHIFT, KEY_CTRL equal to KEY_LEFT_CTRL, KEY_ALT equal to KEY_LEFT_ALT.
This commit is contained in:
parent
5ab4f16fb1
commit
8b78c181ce
|
@ -52,8 +52,14 @@ public:
|
|||
KEY_RETURN,
|
||||
KEY_CAPS_LOCK,
|
||||
KEY_SHIFT,
|
||||
KEY_LEFT_SHIFT = KEY_SHIFT,
|
||||
KEY_RIGHT_SHIFT,
|
||||
KEY_CTRL,
|
||||
KEY_LEFT_CTRL = KEY_CTRL,
|
||||
KEY_RIGHT_CTRL,
|
||||
KEY_ALT,
|
||||
KEY_LEFT_ALT = KEY_ALT,
|
||||
KEY_RIGHT_ALT,
|
||||
KEY_MENU,
|
||||
KEY_HYPER,
|
||||
KEY_INSERT,
|
||||
|
@ -201,13 +207,7 @@ public:
|
|||
KEY_DPAD_DOWN,
|
||||
KEY_DPAD_CENTER,
|
||||
KEY_ENTER,
|
||||
KEY_PLAY,
|
||||
KEY_LEFT_CTRL,
|
||||
KEY_RIGHT_CTRL,
|
||||
KEY_LEFT_ALT,
|
||||
KEY_RIGHT_ALT,
|
||||
KEY_LEFT_SHIFT,
|
||||
KEY_RIGHT_SHIFT
|
||||
KEY_PLAY
|
||||
};
|
||||
|
||||
EventKeyboard(KeyCode keyCode, bool isPressed);
|
||||
|
|
|
@ -661,38 +661,11 @@ void GLViewImpl::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double
|
|||
|
||||
void GLViewImpl::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
EventKeyboard::KeyCode additionalKeyCode = EventKeyboard::KeyCode::KEY_NONE;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case GLFW_KEY_LEFT_ALT:
|
||||
case GLFW_KEY_RIGHT_ALT:
|
||||
additionalKeyCode = EventKeyboard::KeyCode::KEY_ALT;
|
||||
break;
|
||||
case GLFW_KEY_LEFT_CONTROL:
|
||||
case GLFW_KEY_RIGHT_CONTROL:
|
||||
additionalKeyCode = EventKeyboard::KeyCode::KEY_CTRL;
|
||||
break;
|
||||
case GLFW_KEY_LEFT_SHIFT:
|
||||
case GLFW_KEY_RIGHT_SHIFT:
|
||||
additionalKeyCode = EventKeyboard::KeyCode::KEY_SHIFT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GLFW_REPEAT != action)
|
||||
{
|
||||
EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action);
|
||||
auto dispatcher = Director::getInstance()->getEventDispatcher();
|
||||
dispatcher->dispatchEvent(&event);
|
||||
|
||||
// Keep compatibility for the old keycodes like SHIFT, CTRL, ALT.
|
||||
if (additionalKeyCode != EventKeyboard::KeyCode::KEY_NONE)
|
||||
{
|
||||
EventKeyboard additionalEvent(additionalKeyCode, GLFW_PRESS == action);
|
||||
dispatcher->dispatchEvent(&additionalEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if (GLFW_RELEASE != action && g_keyCodeMap[key] == EventKeyboard::KeyCode::KEY_BACKSPACE)
|
||||
|
|
Loading…
Reference in New Issue