//----------------------------------------------------------------------------// void GLFWCALL CEGuiGLFWSharedBase::glfwKeyCallback(int key, int action) { CEGUI::Key::Scan ceguiKey = GlfwToCeguiKey(key); if(action == GLFW_PRESS) CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown(ceguiKey); else if (action == GLFW_RELEASE) CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp(ceguiKey); }
//----------------------------------------------------------------------------// void GLFWCALL CEGuiGLFWSharedBase::glfwKeyCallback(int key, int action) { CEGUI::Key::Scan ceguiKey = GlfwToCeguiKey(key); if(action == GLFW_PRESS) d_sampleApp->injectKeyDown(ceguiKey); else if (action == GLFW_RELEASE) d_sampleApp->injectKeyUp(ceguiKey); }
// default callback implementations void InputManager::key_callback( GLFWwindow* window, int key, int scancode, int action, int mods ) { if (key == GLFW_KEY_UP && action == GLFW_PRESS) { Compositor::Instance().ZoomCamera(-10); } else if (key == GLFW_KEY_DOWN && action == GLFW_PRESS) { Compositor::Instance().ZoomCamera(10); } // pass through to CEGUI if (action == GLFW_PRESS) { CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown( (CEGUI::Key::Scan)GlfwToCeguiKey(key) ); } else if (action == GLFW_RELEASE) { CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp( (CEGUI::Key::Scan)GlfwToCeguiKey(key) ); } }