From e70ced5e05009b858956f6b04f62d1dc29f903d4 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Fri, 7 Sep 2012 02:15:54 +0200
Subject: [PATCH] Fixed bad editing in Cocoa joystick code.
---
readme.html | 2 ++
src/cocoa_joystick.m | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/readme.html b/readme.html
index 497546cd..314c392a 100644
--- a/readme.html
+++ b/readme.html
@@ -924,6 +924,8 @@ their skills. Special thanks go out to:
Much of the Windows code of GLFW was originally based on Jeff's
code
+ Julian Møller, for reporting a bug in the Cocoa joystick code
+
Arturo J. Pérez, for a bug fix for cursor tracking on Mac OS X 10.6 Snow
Leopard
diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m
index 7eac7f91..04c9e972 100644
--- a/src/cocoa_joystick.m
+++ b/src/cocoa_joystick.m
@@ -550,15 +550,15 @@ int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes)
for (i = 0; i < numaxes; i++)
{
- _glfwJoystickElement* axes =
+ _glfwJoystickElement* elements =
(_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick.axes, i);
- long readScale = axes->maxReport - axes->minReport;
+ long readScale = elements->maxReport - elements->minReport;
if (readScale == 0)
- axes[i] = axes->value;
+ axes[i] = elements->value;
else
- axes[i] = (2.0f * (axes->value - axes->minReport) / readScale) - 1.0f;
+ axes[i] = (2.0f * (elements->value - elements->minReport) / readScale) - 1.0f;
if (i & 1)
axes[i] = -axes[i];