Skip to content
Snippets Groups Projects
Commit 7ae851a0 authored by Vanessa Karolek's avatar Vanessa Karolek
Browse files

[#60] use glfw pointer function to retrieve window

parent 0bc5fc2f
Branches
Tags
1 merge request!65Resolve "Kamera - Steuerung mittels Controller"
Pipeline #25799 passed
......@@ -55,11 +55,12 @@ namespace vkcv {
glfwSetScrollCallback(m_window, Window::onMouseScrollEvent);
glfwSetJoystickCallback(nullptr); // use this before to avoid crashing
glfwSetJoystickUserPointer(GLFW_JOYSTICK_1, this);
}
void Window::pollEvents() {
onGamepadEvent(GLFW_JOYSTICK_1, this);
onGamepadEvent(GLFW_JOYSTICK_1);
glfwPollEvents();
}
......@@ -103,7 +104,8 @@ namespace vkcv {
}
}
void Window::onGamepadEvent(int gamepadIndex, Window *window) {
void Window::onGamepadEvent(int gamepadIndex) {
auto window = static_cast<Window *>(glfwGetJoystickUserPointer(gamepadIndex));
if (glfwJoystickPresent(gamepadIndex)) {
window->e_gamepad(gamepadIndex);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment