mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 02:31:46 +00:00
Renamed glfwGetJoystickPos to glfwGetJoystickAxes.
This commit is contained in:
parent
38e4cc3dad
commit
2502e4d6f3
@ -564,7 +564,7 @@ GLFWAPI void glfwSetScrollCallback(GLFWscrollfun cbfun);
|
|||||||
|
|
||||||
/* Joystick input */
|
/* Joystick input */
|
||||||
GLFWAPI int glfwGetJoystickParam(int joy, int param);
|
GLFWAPI int glfwGetJoystickParam(int joy, int param);
|
||||||
GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes);
|
GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes);
|
||||||
GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
|
GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
|
||||||
|
|
||||||
/* Clipboard */
|
/* Clipboard */
|
||||||
|
@ -300,6 +300,7 @@ version of GLFW.</p>
|
|||||||
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
|
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
|
||||||
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
|
||||||
<li>Renamed <code>GLFW_NO_GLU</code> to <code>GLFW_INCLUDE_GLU</code> and made it disabled by default</li>
|
<li>Renamed <code>GLFW_NO_GLU</code> to <code>GLFW_INCLUDE_GLU</code> and made it disabled by default</li>
|
||||||
|
<li>Renamed <code>glfwGetJoystickPos</code> to <code>glfwGetJoystickAxes</code> to match <code>glfwGetJoystickButtons</code></li>
|
||||||
<li>Renamed mouse position functions to cursor position equivalents</li>
|
<li>Renamed mouse position functions to cursor position equivalents</li>
|
||||||
<li>Replaced <code>glfwOpenWindow</code> and <code>glfwCloseWindow</code> with <code>glfwCreateWindow</code> and <code>glfwDestroyWindow</code></li>
|
<li>Replaced <code>glfwOpenWindow</code> and <code>glfwCloseWindow</code> with <code>glfwCreateWindow</code> and <code>glfwDestroyWindow</code></li>
|
||||||
<li>Replaced ad hoc build system with CMake</li>
|
<li>Replaced ad hoc build system with CMake</li>
|
||||||
|
@ -528,7 +528,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
|||||||
// Get joystick axis positions
|
// Get joystick axis positions
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
|
int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -556,12 +556,12 @@ int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
|
|||||||
long readScale = axes->maxReport - axes->minReport;
|
long readScale = axes->maxReport - axes->minReport;
|
||||||
|
|
||||||
if (readScale == 0)
|
if (readScale == 0)
|
||||||
pos[i] = axes->value;
|
axes[i] = axes->value;
|
||||||
else
|
else
|
||||||
pos[i] = (2.0f * (axes->value - axes->minReport) / readScale) - 1.0f;
|
axes[i] = (2.0f * (axes->value - axes->minReport) / readScale) - 1.0f;
|
||||||
|
|
||||||
if (i & 1)
|
if (i & 1)
|
||||||
pos[i] = -pos[i];
|
axes[i] = -axes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return numaxes;
|
return numaxes;
|
||||||
|
@ -273,7 +273,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window);
|
|||||||
|
|
||||||
// Joystick input
|
// Joystick input
|
||||||
int _glfwPlatformGetJoystickParam(int joy, int param);
|
int _glfwPlatformGetJoystickParam(int joy, int param);
|
||||||
int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes);
|
int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes);
|
||||||
int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
|
int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
|
||||||
|
|
||||||
// Time input
|
// Time input
|
||||||
|
@ -61,7 +61,7 @@ GLFWAPI int glfwGetJoystickParam(int joy, int param)
|
|||||||
// Get joystick axis positions
|
// Get joystick axis positions
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes)
|
GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == NULL || numaxes < 0)
|
if (axes == NULL || numaxes < 0)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
_glfwSetError(GLFW_INVALID_VALUE, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
@ -85,9 +85,9 @@ GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes)
|
|||||||
|
|
||||||
// Clear positions
|
// Clear positions
|
||||||
for (i = 0; i < numaxes; i++)
|
for (i = 0; i < numaxes; i++)
|
||||||
pos[i] = 0.0f;
|
axes[i] = 0.0f;
|
||||||
|
|
||||||
return _glfwPlatformGetJoystickPos(joy, pos, numaxes);
|
return _glfwPlatformGetJoystickAxes(joy, axes, numaxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
|||||||
// Get joystick axis positions
|
// Get joystick axis positions
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
|
int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes)
|
||||||
{
|
{
|
||||||
JOYCAPS jc;
|
JOYCAPS jc;
|
||||||
JOYINFOEX ji;
|
JOYINFOEX ji;
|
||||||
@ -137,22 +137,22 @@ int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
|
|||||||
// Get position values for all axes
|
// Get position values for all axes
|
||||||
axis = 0;
|
axis = 0;
|
||||||
if (axis < numaxes)
|
if (axis < numaxes)
|
||||||
pos[axis++] = calcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax);
|
axes[axis++] = calcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax);
|
||||||
|
|
||||||
if (axis < numaxes)
|
if (axis < numaxes)
|
||||||
pos[axis++] = -calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
|
axes[axis++] = -calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
|
||||||
|
|
||||||
if (axis < numaxes && jc.wCaps & JOYCAPS_HASZ)
|
if (axis < numaxes && jc.wCaps & JOYCAPS_HASZ)
|
||||||
pos[axis++] = calcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax);
|
axes[axis++] = calcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax);
|
||||||
|
|
||||||
if (axis < numaxes && jc.wCaps & JOYCAPS_HASR)
|
if (axis < numaxes && jc.wCaps & JOYCAPS_HASR)
|
||||||
pos[axis++] = calcJoystickPos(ji.dwRpos, jc.wRmin, jc.wRmax);
|
axes[axis++] = calcJoystickPos(ji.dwRpos, jc.wRmin, jc.wRmax);
|
||||||
|
|
||||||
if (axis < numaxes && jc.wCaps & JOYCAPS_HASU)
|
if (axis < numaxes && jc.wCaps & JOYCAPS_HASU)
|
||||||
pos[axis++] = calcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax);
|
axes[axis++] = calcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax);
|
||||||
|
|
||||||
if (axis < numaxes && jc.wCaps & JOYCAPS_HASV)
|
if (axis < numaxes && jc.wCaps & JOYCAPS_HASV)
|
||||||
pos[axis++] = -calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
|
axes[axis++] = -calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
|
||||||
|
|
||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
|||||||
// Get joystick axis positions
|
// Get joystick axis positions
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
int _glfwPlatformGetJoystickPos(int joy, float* pos, int numAxes)
|
int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numAxes)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ int _glfwPlatformGetJoystickPos(int joy, float* pos, int numAxes)
|
|||||||
numAxes = _glfwLibrary.X11.joystick[joy].numAxes;
|
numAxes = _glfwLibrary.X11.joystick[joy].numAxes;
|
||||||
|
|
||||||
for (i = 0; i < numAxes; i++)
|
for (i = 0; i < numAxes; i++)
|
||||||
pos[i] = _glfwLibrary.X11.joystick[joy].axis[i];
|
axes[i] = _glfwLibrary.X11.joystick[joy].axis[i];
|
||||||
|
|
||||||
return numAxes;
|
return numAxes;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ static void refresh_joysticks(void)
|
|||||||
j->axes = realloc(j->axes, j->axis_count * sizeof(float));
|
j->axes = realloc(j->axes, j->axis_count * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwGetJoystickPos(GLFW_JOYSTICK_1 + i, j->axes, j->axis_count);
|
glfwGetJoystickAxes(GLFW_JOYSTICK_1 + i, j->axes, j->axis_count);
|
||||||
|
|
||||||
button_count = glfwGetJoystickParam(GLFW_JOYSTICK_1 + i, GLFW_BUTTONS);
|
button_count = glfwGetJoystickParam(GLFW_JOYSTICK_1 + i, GLFW_BUTTONS);
|
||||||
if (button_count != j->button_count)
|
if (button_count != j->button_count)
|
||||||
|
Loading…
Reference in New Issue
Block a user