Cleanup and debug prints
This commit is contained in:
parent
5bb839136b
commit
dac8f704cd
2 changed files with 12 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "../Controller.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
@ -19,17 +21,22 @@ void ControllerBackend_Deinit(void)
|
|||
|
||||
BOOL ControllerBackend_Init(void)
|
||||
{
|
||||
for (int i = GLFW_JOYSTICK_1; i < GLFW_JOYSTICK_LAST; ++i)
|
||||
if (glfwJoystickPresent(i) == GLFW_TRUE)
|
||||
printf("Joystick #%d name: %s\n", i, glfwGetJoystickName(i));
|
||||
|
||||
for (int i = GLFW_JOYSTICK_1; i < GLFW_JOYSTICK_LAST; ++i)
|
||||
{
|
||||
if (glfwJoystickPresent(i) == GLFW_TRUE && glfwJoystickIsGamepad(i) == GLFW_TRUE)
|
||||
{
|
||||
printf("Joystick #%d selected\n", i);
|
||||
joystick_connected = TRUE;
|
||||
connected_joystick_id = i;
|
||||
break;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return joystick_connected;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
|
@ -54,7 +53,10 @@ BOOL FindAndOpenDirectInputDevice(void)
|
|||
|
||||
// Break as soon as a joystick is properly opened
|
||||
if (joystick != NULL)
|
||||
{
|
||||
printf("Joystick #%d selected\n", i);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
Loading…
Add table
Reference in a new issue