Fixed constness of joystick data.

master
Camilla Berglund ago%!(EXTRA string=12 years)
parent 179d90956a
commit 180a4ee640
  1. 4
      include/GLFW/glfw3.h
  2. 4
      src/cocoa_joystick.m
  3. 4
      src/internal.h
  4. 4
      src/joystick.c
  5. 4
      src/win32_joystick.c
  6. 4
      src/x11_joystick.c
  7. 4
      tests/joysticks.c

@ -1973,7 +1973,7 @@ GLFWAPI int glfwJoystickPresent(int joy);
* *
* @ingroup input * @ingroup input
*/ */
GLFWAPI float* glfwGetJoystickAxes(int joy, int* count); GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
/*! @brief Returns the values of all buttons of the specified joystick. /*! @brief Returns the values of all buttons of the specified joystick.
* @param[in] joy The joystick to query. * @param[in] joy The joystick to query.
@ -1985,7 +1985,7 @@ GLFWAPI float* glfwGetJoystickAxes(int joy, int* count);
* *
* @ingroup input * @ingroup input
*/ */
GLFWAPI unsigned char* glfwGetJoystickButtons(int joy, int* count); GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
/*! @brief Returns the name of the specified joystick. /*! @brief Returns the name of the specified joystick.
* *

@ -463,7 +463,7 @@ int _glfwPlatformJoystickPresent(int joy)
return _glfw.ns.joysticks[joy].present; return _glfw.ns.joysticks[joy].present;
} }
float* _glfwPlatformGetJoystickAxes(int joy, int* count) const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{ {
_GLFWjoy* joystick = _glfw.ns.joysticks + joy; _GLFWjoy* joystick = _glfw.ns.joysticks + joy;
@ -476,7 +476,7 @@ float* _glfwPlatformGetJoystickAxes(int joy, int* count)
return joystick->axes; return joystick->axes;
} }
unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{ {
_GLFWjoy* joystick = _glfw.ns.joysticks + joy; _GLFWjoy* joystick = _glfw.ns.joysticks + joy;

@ -418,12 +418,12 @@ int _glfwPlatformJoystickPresent(int joy);
/*! @copydoc glfwGetJoystickAxes /*! @copydoc glfwGetJoystickAxes
* @ingroup platform * @ingroup platform
*/ */
float* _glfwPlatformGetJoystickAxes(int joy, int* count); const float* _glfwPlatformGetJoystickAxes(int joy, int* count);
/*! @copydoc glfwGetJoystickButtons /*! @copydoc glfwGetJoystickButtons
* @ingroup platform * @ingroup platform
*/ */
unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count); const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count);
/*! @copydoc glfwGetJoystickName /*! @copydoc glfwGetJoystickName
* @ingroup platform * @ingroup platform

@ -48,7 +48,7 @@ GLFWAPI int glfwJoystickPresent(int joy)
return _glfwPlatformJoystickPresent(joy); return _glfwPlatformJoystickPresent(joy);
} }
GLFWAPI float* glfwGetJoystickAxes(int joy, int* count) GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
{ {
*count = 0; *count = 0;
@ -63,7 +63,7 @@ GLFWAPI float* glfwGetJoystickAxes(int joy, int* count)
return _glfwPlatformGetJoystickAxes(joy, count); return _glfwPlatformGetJoystickAxes(joy, count);
} }
GLFWAPI unsigned char* glfwGetJoystickButtons(int joy, int* count) GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
{ {
*count = 0; *count = 0;

@ -84,7 +84,7 @@ int _glfwPlatformJoystickPresent(int joy)
return GL_TRUE; return GL_TRUE;
} }
float* _glfwPlatformGetJoystickAxes(int joy, int* count) const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{ {
JOYCAPS jc; JOYCAPS jc;
JOYINFOEX ji; JOYINFOEX ji;
@ -117,7 +117,7 @@ float* _glfwPlatformGetJoystickAxes(int joy, int* count)
return axes; return axes;
} }
unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{ {
JOYCAPS jc; JOYCAPS jc;
JOYINFOEX ji; JOYINFOEX ji;

@ -241,7 +241,7 @@ int _glfwPlatformJoystickPresent(int joy)
return _glfw.x11.joystick[joy].present; return _glfw.x11.joystick[joy].present;
} }
float* _glfwPlatformGetJoystickAxes(int joy, int* count) const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{ {
pollJoystickEvents(); pollJoystickEvents();
@ -252,7 +252,7 @@ float* _glfwPlatformGetJoystickAxes(int joy, int* count)
return _glfw.x11.joystick[joy].axes; return _glfw.x11.joystick[joy].axes;
} }
unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{ {
pollJoystickEvents(); pollJoystickEvents();

@ -138,8 +138,8 @@ static void refresh_joysticks(void)
if (glfwJoystickPresent(GLFW_JOYSTICK_1 + i)) if (glfwJoystickPresent(GLFW_JOYSTICK_1 + i))
{ {
float* axes; const float* axes;
unsigned char* buttons; const unsigned char* buttons;
int axis_count, button_count; int axis_count, button_count;
free(j->name); free(j->name);

Loading…
Cancel
Save