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

[#60][Fix] fix active window indexing

Per default, if all windows are out of focus, the first window is used as reference.
parent 71363ee5
No related branches found
No related tags found
1 merge request!65Resolve "Kamera - Steuerung mittels Controller"
Pipeline #25938 passed
...@@ -149,6 +149,7 @@ namespace vkcv { ...@@ -149,6 +149,7 @@ namespace vkcv {
s_Windows.end(), s_Windows.end(),
[](GLFWwindow* window){return glfwGetWindowAttrib(window, GLFW_FOCUSED);}) [](GLFWwindow* window){return glfwGetWindowAttrib(window, GLFW_FOCUSED);})
- s_Windows.begin(); - s_Windows.begin();
activeWindowIndex *= (activeWindowIndex < s_Windows.size()); // fixes index getting out of bounds (e.g. if there is no focused window)
auto window = static_cast<Window *>(glfwGetWindowUserPointer(s_Windows[activeWindowIndex])); auto window = static_cast<Window *>(glfwGetWindowUserPointer(s_Windows[activeWindowIndex]));
if (window != nullptr && glfwJoystickPresent(gamepadIndex)) { if (window != nullptr && glfwJoystickPresent(gamepadIndex)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment