From cd758dabe039bd8e96946ed05e58f1114cc40f62 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 25 Feb 2013 01:51:21 -0500 Subject: [PATCH] Added SDL_GameControllerUpdate(). --- include/SDL_gamecontroller.h | 9 +++++++++ src/joystick/SDL_gamecontroller.c | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index ee182732e..7cb9ed1f4 100644 --- a/include/SDL_gamecontroller.h +++ b/include/SDL_gamecontroller.h @@ -160,6 +160,15 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont */ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); +/** + * Update the current state of the open game controllers. + * + * This is called automatically by the event loop if any game controller + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); + + /** * The list of axii available from a controller */ diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index b8ec61509..24bf07a00 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -824,6 +824,16 @@ SDL_GameControllerOpen(int device_index) return (gamecontroller); } +/* + * Manually pump for controller updates. + */ +void +SDL_GameControllerUpdate(void) +{ + /* Just for API completeness; the joystick API does all the work. */ + SDL_JoystickUpdate(); +} + /* * Get the current state of an axis control on a controller