From db1db3f5b446847c05554f5879360fd098ccec68 Mon Sep 17 00:00:00 2001 From: Mark Oates Date: Wed, 22 Mar 2023 19:50:56 -0400 Subject: [PATCH] Add "al_get_joystick_device_id" to api --- docs/src/refman/joystick.txt | 4 ++++ include/allegro5/joystick.h | 1 + src/joynu.c | 13 +++++++++++++ 3 files changed, 18 insertions(+) diff --git a/docs/src/refman/joystick.txt b/docs/src/refman/joystick.txt index 2a0398a456..a76f9585ab 100644 --- a/docs/src/refman/joystick.txt +++ b/docs/src/refman/joystick.txt @@ -131,6 +131,10 @@ handles may become inactive, and vice versa. See also: [al_reconfigure_joysticks] +## API: al_get_joystick_device_id + +Return the device id of the given joystick. + ## API: al_get_joystick_name Return the name of the given joystick. diff --git a/include/allegro5/joystick.h b/include/allegro5/joystick.h index 4b3e648b98..a22ce83066 100644 --- a/include/allegro5/joystick.h +++ b/include/allegro5/joystick.h @@ -81,6 +81,7 @@ AL_FUNC(int, al_get_joystick_num_buttons, (ALLEGRO_JOYSTICK *)); AL_FUNC(const char*, al_get_joystick_button_name, (ALLEGRO_JOYSTICK *, int buttonn)); AL_FUNC(void, al_get_joystick_state, (ALLEGRO_JOYSTICK *, ALLEGRO_JOYSTICK_STATE *ret_state)); +AL_FUNC(int, al_get_joystick_device_id, (ALLEGRO_JOYSTICK *)); AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_joystick_event_source, (void)); diff --git a/src/joynu.c b/src/joynu.c index ef3ced8dbc..58625df4f3 100644 --- a/src/joynu.c +++ b/src/joynu.c @@ -300,6 +300,19 @@ void al_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_st new_joystick_driver->get_joystick_state(joy, ret_state); } + + +/* Function: al_get_joystick_device_id + */ +int al_get_joystick_device_id(ALLEGRO_JOYSTICK *joy) +{ + ASSERT(new_joystick_driver); + + return new_joystick_driver->get_device_id(joy); +} + + + /* * Local Variables: * c-basic-offset: 3