diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp index 782f8e3ed..7337fcabb 100644 --- a/src/SFML/Window/WindowImpl.cpp +++ b/src/SFML/Window/WindowImpl.cpp @@ -223,7 +223,8 @@ void WindowImpl::ProcessJoystickEvents() // Axis for (unsigned int j = 0; j < Joy::Count; ++j) { - if (myJoysticks[i].HasAxis(static_cast(i))) + Joy::Axis Axis = static_cast(j); + if (myJoysticks[i].HasAxis(Axis)) { float PrevPos = PreviousState.Axis[j]; float CurrPos = myJoyStates[i].Axis[j]; @@ -232,7 +233,7 @@ void WindowImpl::ProcessJoystickEvents() Event Event; Event.Type = Event::JoyMoved; Event.JoyMove.JoystickId = i; - Event.JoyMove.Axis = static_cast(j); + Event.JoyMove.Axis = Axis; Event.JoyMove.Position = CurrPos; SendEvent(Event); }