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 "../Controller.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define GLFW_INCLUDE_NONE
|
#define GLFW_INCLUDE_NONE
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
@ -19,17 +21,22 @@ void ControllerBackend_Deinit(void)
|
||||||
|
|
||||||
BOOL ControllerBackend_Init(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)
|
for (int i = GLFW_JOYSTICK_1; i < GLFW_JOYSTICK_LAST; ++i)
|
||||||
{
|
{
|
||||||
if (glfwJoystickPresent(i) == GLFW_TRUE && glfwJoystickIsGamepad(i) == GLFW_TRUE)
|
if (glfwJoystickPresent(i) == GLFW_TRUE && glfwJoystickIsGamepad(i) == GLFW_TRUE)
|
||||||
{
|
{
|
||||||
|
printf("Joystick #%d selected\n", i);
|
||||||
joystick_connected = TRUE;
|
joystick_connected = TRUE;
|
||||||
connected_joystick_id = i;
|
connected_joystick_id = i;
|
||||||
break;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return joystick_connected;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
@ -54,8 +53,11 @@ BOOL FindAndOpenDirectInputDevice(void)
|
||||||
|
|
||||||
// Break as soon as a joystick is properly opened
|
// Break as soon as a joystick is properly opened
|
||||||
if (joystick != NULL)
|
if (joystick != NULL)
|
||||||
|
{
|
||||||
|
printf("Joystick #%d selected\n", i);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue