Shuffle code
This commit is contained in:
parent
d957c40649
commit
e00ad1cd78
3 changed files with 23 additions and 23 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "../Input.h"
|
||||
|
||||
void ControllerBackend_Deinit(void);
|
||||
BOOL ControllerBackend_Init(void);
|
||||
void ControllerBackend_Deinit(void);
|
||||
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status);
|
||||
BOOL ControllerBackend_ResetJoystickStatus(void);
|
||||
|
|
|
@ -57,16 +57,6 @@ static void JoystickCallback(int joystick_id, int event)
|
|||
}
|
||||
}
|
||||
|
||||
void ControllerBackend_Deinit(void)
|
||||
{
|
||||
glfwSetJoystickCallback(NULL);
|
||||
|
||||
joystick_connected = FALSE;
|
||||
connected_joystick_id = 0;
|
||||
joystick_neutral_x = 0;
|
||||
joystick_neutral_y = 0;
|
||||
}
|
||||
|
||||
BOOL ControllerBackend_Init(void)
|
||||
{
|
||||
// Connect joysticks that are already plugged-in
|
||||
|
@ -80,6 +70,16 @@ BOOL ControllerBackend_Init(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void ControllerBackend_Deinit(void)
|
||||
{
|
||||
glfwSetJoystickCallback(NULL);
|
||||
|
||||
joystick_connected = FALSE;
|
||||
connected_joystick_id = 0;
|
||||
joystick_neutral_x = 0;
|
||||
joystick_neutral_y = 0;
|
||||
}
|
||||
|
||||
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
||||
{
|
||||
if (!joystick_connected)
|
||||
|
|
|
@ -12,18 +12,6 @@ static SDL_Joystick *joystick = NULL;
|
|||
static int joystick_neutral_x = 0;
|
||||
static int joystick_neutral_y = 0;
|
||||
|
||||
void ControllerBackend_Deinit(void)
|
||||
{
|
||||
// Close opened joystick (if exists)
|
||||
if (joystick != NULL)
|
||||
{
|
||||
SDL_JoystickClose(joystick);
|
||||
joystick = NULL;
|
||||
}
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
}
|
||||
|
||||
// It looks like Pixel declared his functions early, so he could forward-reference
|
||||
BOOL FindAndOpenDirectInputDevice(void);
|
||||
|
||||
|
@ -37,6 +25,18 @@ BOOL ControllerBackend_Init(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void ControllerBackend_Deinit(void)
|
||||
{
|
||||
// Close opened joystick (if exists)
|
||||
if (joystick != NULL)
|
||||
{
|
||||
SDL_JoystickClose(joystick);
|
||||
joystick = NULL;
|
||||
}
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
}
|
||||
|
||||
// The original name for this function and its variables are unknown.
|
||||
// This function finds and hooks the first available DirectInput device (or SDL Joystick, in this case).
|
||||
BOOL FindAndOpenDirectInputDevice(void)
|
||||
|
|
Loading…
Add table
Reference in a new issue