From 1a03c08672a5c0e8deffc170672e49c850e534a2 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sun, 29 Sep 2013 01:29:43 +0100
Subject: [PATCH] [Add] Documented joystick.c

---
 src/joystick.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

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 <SDL.h>
 #include <string.h>
 #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);
 }