void WindowController3d::KeyPressCallback()

in body-tracking-samples/sample_helper_libs/window_controller_3d/WindowController3d.cpp [582:618]


void WindowController3d::KeyPressCallback(GLFWwindow* /*window*/, int key, int /*scancode*/, int action, int /*mods*/)
{
    // https://www.glfw.org/docs/latest/group__keys.html
    if (action == GLFW_RELEASE)
    {
        return;
    }

    switch (key)
    {
    case GLFW_KEY_HOME:
        m_viewControl.Reset();
        break;
    case GLFW_KEY_F1:
        m_viewControl.SetViewPoint(ViewPoint::FrontView);
        break;
    case GLFW_KEY_F2:
        m_viewControl.SetViewPoint(ViewPoint::RightView);
        break;
    case GLFW_KEY_F3:
        m_viewControl.SetViewPoint(ViewPoint::BackView);
        break;
    case GLFW_KEY_F4:
        m_viewControl.SetViewPoint(ViewPoint::LeftView);
        break;
    case GLFW_KEY_F5:
        m_viewControl.SetViewPoint(ViewPoint::TopView);
        break;
    default:
        // If not handled, then pass along to external callback.
        if (m_keyCallback)
        {
            m_keyCallback(m_keyCallbackContext, key);
        }
        break;
    }
}