diff --git a/src/joystick.c b/src/joystick.c index b5b8ef9..8e0f612 100644 --- a/src/joystick.c +++ b/src/joystick.c @@ -1,11 +1,25 @@ +/** + * @file joystick.c + * + * @brief Handles joystick initialization. + */ + #include #include #include "lephisto.h" #include "log.h" #include "joystick.h" -static SDL_Joystick* joystick = NULL; +static SDL_Joystick* joystick = NULL; /**< Current joystick in use. */ + +/** + * @fn int joystick_get(char* namjoystick) + * + * @brief Get the joystick index by name. + * @param namjoystick Looks for given string in the joystick name. + * @return The index if found, defaults to 0 if it isn't found. + */ int joystick_get(char* namjoystick) { int i; for(i = 0; i < SDL_NumJoysticks(); i++) @@ -17,6 +31,13 @@ int joystick_get(char* namjoystick) { return 0; } +/** + * @fn int joystick_use(int indjoystick) + * + * @brief Make the game use a joystick by index. + * @param indjoystick Index of the joystick to use. + * @return 0 on success. + */ int joystick_use(int indjoystick) { if(indjoystick < 0 || indjoystick >= SDL_NumJoysticks()) { WARN("Joystick of index number %d does not exist. Switching to default (0)", @@ -41,6 +62,12 @@ int joystick_use(int indjoystick) { return 0; } +/** + * @fn int joystick_init(void) + * + * @brief Initializes the joystick subsystem. + * @return 0 on success. + */ int joystick_init(void) { int numjoysticks, i; @@ -62,6 +89,11 @@ int joystick_init(void) { return 0; } +/** + * @fn void joystick_exit(void) + * + * @brief Exit the joystick subsystem. + */ void joystick_exit(void) { SDL_JoystickClose(joystick); }