Trigger onKeyReleased only after the key has been released

This commit is contained in:
Michael Contento 2013-11-02 06:15:08 +01:00
parent f560b11c75
commit ffad18a1ed
3 changed files with 3 additions and 3 deletions

View File

@ -256,7 +256,7 @@ void EGLViewEventHandler::OnGLFWMouseScrollCallback(GLFWwindow* window, double x
void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
{ {
EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action); EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action || GLFW_REPEAT == action);
auto dispatcher = Director::getInstance()->getEventDispatcher(); auto dispatcher = Director::getInstance()->getEventDispatcher();
dispatcher->dispatchEvent(&event); dispatcher->dispatchEvent(&event);
} }

View File

@ -274,7 +274,7 @@ void EGLViewEventHandler::OnGLFWMouseScrollCallback(GLFWwindow* window, double x
void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
{ {
EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action); EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action || GLFW_REPEAT == action);
auto dispatcher = Director::getInstance()->getEventDispatcher(); auto dispatcher = Director::getInstance()->getEventDispatcher();
dispatcher->dispatchEvent(&event); dispatcher->dispatchEvent(&event);
} }

View File

@ -373,7 +373,7 @@ void EGLViewEventHandler::OnGLFWMouseScrollCallback(GLFWwindow* window, double x
void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
{ {
EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action); EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action || GLFW_REPEAT == action);
auto dispatcher = Director::getInstance()->getEventDispatcher(); auto dispatcher = Director::getInstance()->getEventDispatcher();
dispatcher->dispatchEvent(&event); dispatcher->dispatchEvent(&event);
} }