MCPcopy Create free account
hub / github.com/axmolengine/axmol / onGLFWKeyCallback

Method onGLFWKeyCallback

core/platform/RenderViewImpl.cpp:1246–1274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1244}
1245
1246void RenderViewImpl::onGLFWKeyCallback(GLFWwindow* /*window*/, int key, int /*scancode*/, int action, int /*mods*/)
1247{
1248 const auto isKeyDown = action != GLFW_RELEASE;
1249 EventKeyboard event(g_keyCodeMap[key], isKeyDown, action == GLFW_REPEAT);
1250 auto dispatcher = Director::getInstance()->getEventDispatcher();
1251 dispatcher->dispatchEvent(&event);
1252
1253 if (isKeyDown && !event.isStopped())
1254 {
1255 switch (g_keyCodeMap[key])
1256 {
1257 case EventKeyboard::KeyCode::KEY_BACKSPACE:
1258 IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(1);
1259 break;
1260 case EventKeyboard::KeyCode::KEY_HOME:
1261 case EventKeyboard::KeyCode::KEY_KP_HOME:
1262 case EventKeyboard::KeyCode::KEY_DELETE:
1263 case EventKeyboard::KeyCode::KEY_KP_DELETE:
1264 case EventKeyboard::KeyCode::KEY_END:
1265 case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
1266 case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
1267 case EventKeyboard::KeyCode::KEY_ESCAPE:
1268 IMEDispatcher::sharedDispatcher()->dispatchControlKey(g_keyCodeMap[key]);
1269 break;
1270 default:
1271 break;
1272 }
1273 }
1274}
1275
1276void RenderViewImpl::onGLFWCharCallback(GLFWwindow* /*window*/, unsigned int charCode)
1277{

Callers 1

onGLFWKeyCallbackMethod · 0.45

Calls 4

getInstanceFunction · 0.85
dispatchControlKeyMethod · 0.80
dispatchEventMethod · 0.45

Tested by

no test coverage detected