mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 10:48:51 -05:00
Fixed VC++ errors.
This commit is contained in:
parent
24fa448535
commit
53fab2f16b
16
src/win32_joystick.c
Normal file → Executable file
16
src/win32_joystick.c
Normal file → Executable file
|
@ -80,6 +80,7 @@ static float calcJoystickPos(DWORD pos, DWORD min, DWORD max)
|
||||||
int _glfwPlatformGetJoystickParam(int joy, int param)
|
int _glfwPlatformGetJoystickParam(int joy, int param)
|
||||||
{
|
{
|
||||||
JOYCAPS jc;
|
JOYCAPS jc;
|
||||||
|
int hats;
|
||||||
|
|
||||||
if (!isJoystickPresent(joy))
|
if (!isJoystickPresent(joy))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -91,7 +92,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
||||||
// Get joystick capabilities
|
// Get joystick capabilities
|
||||||
_glfw_joyGetDevCaps(joy - GLFW_JOYSTICK_1, &jc, sizeof(JOYCAPS));
|
_glfw_joyGetDevCaps(joy - GLFW_JOYSTICK_1, &jc, sizeof(JOYCAPS));
|
||||||
|
|
||||||
const int hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
|
hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
|
||||||
|
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
|
@ -166,7 +167,10 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
|
||||||
{
|
{
|
||||||
JOYCAPS jc;
|
JOYCAPS jc;
|
||||||
JOYINFOEX ji;
|
JOYINFOEX ji;
|
||||||
int button;
|
int button, hats;
|
||||||
|
|
||||||
|
// Bit fields of button presses for each direction, including nil
|
||||||
|
const int directions[9] = { 1, 3, 2, 6, 4, 12, 8, 9, 0 };
|
||||||
|
|
||||||
if (!isJoystickPresent(joy))
|
if (!isJoystickPresent(joy))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -187,11 +191,11 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Virtual buttons - Inject data from hats
|
// Virtual buttons - Inject data from hats
|
||||||
// Each hat is exposed as 4 buttons which exposes 8 directions with concurrent button presses
|
// Each hat is exposed as 4 buttons which exposes 8 directions with
|
||||||
// (Note: This API only exposes one hat)
|
// concurrent button presses
|
||||||
|
// NOTE: this API exposes only one hat
|
||||||
|
|
||||||
const int hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
|
hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
|
||||||
const int directions[9] = { 1, 3, 2, 6, 4, 12, 8, 9, 0 }; // Bit fields of button presses for each direction, including nil
|
|
||||||
|
|
||||||
if (hats > 0)
|
if (hats > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user