click-drag rotation

This commit is contained in:
2018-12-12 02:13:47 -05:00
parent fbdd9ac0df
commit 61d2b3a65b
6 changed files with 127 additions and 24 deletions

View File

@@ -124,6 +124,11 @@ void App::onCursorPos(GLFWwindow *window, double x, double y) {
if (app) app->onCursorPos(x, y);
}
void App::onMouseButton(GLFWwindow *window, int button, int action, int mods) {
auto *app = get(window);
if (app) app->onMouseButton(button, action, mods);
}
int App::run() {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, _gl_major);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, _gl_minor);
@@ -137,6 +142,7 @@ int App::run() {
glfwSetWindowSizeCallback(getWindow(), App::onSize);
glfwSetKeyCallback(getWindow(), App::onKey);
glfwSetCursorPosCallback(getWindow(), App::onCursorPos);
glfwSetMouseButtonCallback(getWindow(), App::onMouseButton);
glfwMakeContextCurrent(_window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);