mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00: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)
|
||||
{
|
||||
JOYCAPS jc;
|
||||
int hats;
|
||||
|
||||
if (!isJoystickPresent(joy))
|
||||
return 0;
|
||||
@ -91,7 +92,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
||||
// Get joystick capabilities
|
||||
_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)
|
||||
{
|
||||
@ -166,7 +167,10 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
|
||||
{
|
||||
JOYCAPS jc;
|
||||
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))
|
||||
return 0;
|
||||
@ -187,11 +191,11 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
|
||||
}
|
||||
|
||||
// Virtual buttons - Inject data from hats
|
||||
// Each hat is exposed as 4 buttons which exposes 8 directions with concurrent button presses
|
||||
// (Note: This API only exposes one hat)
|
||||
// Each hat is exposed as 4 buttons which exposes 8 directions with
|
||||
// concurrent button presses
|
||||
// NOTE: this API exposes only one hat
|
||||
|
||||
const int 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
|
||||
hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
|
||||
|
||||
if (hats > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user