Test polling joystick button events
This commit is contained in:
parent
99ee13bbdf
commit
57fafad066
|
|
@ -156,6 +156,7 @@ static void ProcessKeyboard(void); // Process keyboard even
|
|||
|
||||
static void InitDrmInput(void); // Initialize inputs for DRM platform
|
||||
static void InitDrmJoystick(int index, const char *path); // Initialize a joystick for DRM platform
|
||||
static void PollDrmJoystickEvents();
|
||||
|
||||
static void InitEvdevInput(void); // Initialize evdev inputs
|
||||
static void ConfigureEvdevDevice(char *device); // Identifies a input device and configures it for use if appropriate
|
||||
|
|
@ -869,6 +870,7 @@ void PollInputEvents(void)
|
|||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||
}
|
||||
|
||||
PollDrmJoystickEvents();
|
||||
PollKeyboardEvents();
|
||||
|
||||
// Register previous mouse states
|
||||
|
|
@ -1534,6 +1536,27 @@ static void InitDrmJoystick(int index, const char *path)
|
|||
CORE.Input.Gamepad.ready[index] = true;
|
||||
}
|
||||
|
||||
static void PollDrmJoystickEvents()
|
||||
{
|
||||
struct input_event ev;
|
||||
|
||||
for (int i = 0; i < MAX_GAMEPADS; i++)
|
||||
{
|
||||
if (!CORE.Input.Gamepad.ready[i])
|
||||
continue;
|
||||
|
||||
while (read(platform.gamepadStreamFd, &ev, sizeof(ev)) > 0)
|
||||
{
|
||||
switch(ev.type)
|
||||
{
|
||||
case EV_KEY:
|
||||
printf("Key %d = %d", ev.code, ev.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise user input from evdev(/dev/input/event<N>)
|
||||
// this means mouse, keyboard or gamepad devices
|
||||
static void InitEvdevInput(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user