mirror of
https://github.com/glfw/glfw.git
synced 2025-01-31 20:30:28 +00:00
parent
37c93ba031
commit
f079d0625d
@ -24,8 +24,8 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#ifndef _glfw3_iokit_joystick_h_
|
#ifndef _glfw3_cocoa_joystick_h_
|
||||||
#define _glfw3_iokit_joystick_h_
|
#define _glfw3_cocoa_joystick_h_
|
||||||
|
|
||||||
#include <IOKit/IOKitLib.h>
|
#include <IOKit/IOKitLib.h>
|
||||||
#include <IOKit/IOCFPlugIn.h>
|
#include <IOKit/IOCFPlugIn.h>
|
||||||
@ -35,7 +35,7 @@
|
|||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWjoystickNS ns_js
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWjoystickNS ns_js
|
||||||
|
|
||||||
|
|
||||||
// IOKit-specific per-joystick data
|
// Cocoa-specific per-joystick data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWjoydeviceNS
|
typedef struct _GLFWjoydeviceNS
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ typedef struct _GLFWjoydeviceNS
|
|||||||
unsigned char* buttons;
|
unsigned char* buttons;
|
||||||
} _GLFWjoydeviceNS;
|
} _GLFWjoydeviceNS;
|
||||||
|
|
||||||
// IOKit-specific joystick API data
|
// Cocoa-specific joystick API data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWjoystickNS
|
typedef struct _GLFWjoystickNS
|
||||||
{
|
{
|
||||||
@ -64,4 +64,4 @@ typedef struct _GLFWjoystickNS
|
|||||||
void _glfwInitJoysticksNS(void);
|
void _glfwInitJoysticksNS(void);
|
||||||
void _glfwTerminateJoysticksNS(void);
|
void _glfwTerminateJoysticksNS(void);
|
||||||
|
|
||||||
#endif // _glfw3_iokit_joystick_h_
|
#endif // _glfw3_cocoa_joystick_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.2 WinMM - www.glfw.org
|
// GLFW 3.2 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -63,7 +63,7 @@ void _glfwTerminateJoysticksWin32(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < GLFW_JOYSTICK_LAST; i++)
|
for (i = 0; i < GLFW_JOYSTICK_LAST; i++)
|
||||||
free(_glfw.winmm_js[i].name);
|
free(_glfw.win32_js[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
|||||||
{
|
{
|
||||||
JOYCAPS jc;
|
JOYCAPS jc;
|
||||||
JOYINFOEX ji;
|
JOYINFOEX ji;
|
||||||
float* axes = _glfw.winmm_js[joy].axes;
|
float* axes = _glfw.win32_js[joy].axes;
|
||||||
|
|
||||||
if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR)
|
if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -118,7 +118,7 @@ const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
|
|||||||
{
|
{
|
||||||
JOYCAPS jc;
|
JOYCAPS jc;
|
||||||
JOYINFOEX ji;
|
JOYINFOEX ji;
|
||||||
unsigned char* buttons = _glfw.winmm_js[joy].buttons;
|
unsigned char* buttons = _glfw.win32_js[joy].buttons;
|
||||||
|
|
||||||
if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR)
|
if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -169,9 +169,9 @@ const char* _glfwPlatformGetJoystickName(int joy)
|
|||||||
if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR)
|
if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
free(_glfw.winmm_js[joy].name);
|
free(_glfw.win32_js[joy].name);
|
||||||
_glfw.winmm_js[joy].name = _glfwCreateUTF8FromWideStringWin32(jc.szPname);
|
_glfw.win32_js[joy].name = _glfwCreateUTF8FromWideStringWin32(jc.szPname);
|
||||||
|
|
||||||
return _glfw.winmm_js[joy].name;
|
return _glfw.win32_js[joy].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.2 WinMM - www.glfw.org
|
// GLFW 3.2 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2006-2014 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2014 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@ -24,24 +24,24 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#ifndef _glfw3_winmm_joystick_h_
|
#ifndef _glfw3_win32_joystick_h_
|
||||||
#define _glfw3_winmm_joystick_h_
|
#define _glfw3_win32_joystick_h_
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
|
||||||
_GLFWjoystickWinMM winmm_js[GLFW_JOYSTICK_LAST + 1]
|
_GLFWjoystickWin32 win32_js[GLFW_JOYSTICK_LAST + 1]
|
||||||
|
|
||||||
|
|
||||||
// WinMM-specific per-joystick data
|
// Win32-specific per-joystick data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWjoystickWinMM
|
typedef struct _GLFWjoystickWin32
|
||||||
{
|
{
|
||||||
float axes[6];
|
float axes[6];
|
||||||
unsigned char buttons[36]; // 32 buttons plus one hat
|
unsigned char buttons[36]; // 32 buttons plus one hat
|
||||||
char* name;
|
char* name;
|
||||||
} _GLFWjoystickWinMM;
|
} _GLFWjoystickWin32;
|
||||||
|
|
||||||
|
|
||||||
void _glfwInitJoysticks(void);
|
void _glfwInitJoysticksWin32(void);
|
||||||
void _glfwTerminateJoysticks(void);
|
void _glfwTerminateJoysticksWin32(void);
|
||||||
|
|
||||||
#endif // _glfw3_winmm_joystick_h_
|
#endif // _glfw3_win32_joystick_h_
|
||||||
|
Loading…
Reference in New Issue
Block a user