Subversion Repositories Kolibri OS

Rev

Rev 8209 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     SDL - Simple DirectMedia Layer
  3.     Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public
  16.     License along with this library; if not, write to the Free
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.     Sam Lantinga
  20.     slouken@devolution.com
  21. */
  22.  
  23. #ifdef SAVE_RCSID
  24. static char rcsid =
  25.  "@(#) $Id: SDL_joystick.h,v 1.2 2001/04/26 16:50:17 hercules Exp $";
  26. #endif
  27.  
  28. /* Include file for SDL joystick event handling */
  29.  
  30. #ifndef _SDL_joystick_h
  31. #define _SDL_joystick_h
  32.  
  33. #include <stddef.h>
  34.  
  35. #include "SDL_types.h"
  36. #include "SDL_error.h"
  37. #include "SDL_events.h"
  38.  
  39. #include "begin_code.h"
  40. /* Set up for C function definitions, even when using C++ */
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44.  
  45. /* In order to use these functions, SDL_Init() must have been called
  46.    with the SDL_INIT_JOYSTICK flag.  This causes SDL to scan the system
  47.    for joysticks, and load appropriate drivers.
  48. */
  49.  
  50. /* The joystick structure used to identify an SDL joystick */
  51. struct _SDL_Joystick;
  52. typedef struct _SDL_Joystick SDL_Joystick;
  53.  
  54. #warning "Joysticks are not supported in KolibriOS. All functions are stubs!"
  55.  
  56. /* Function prototypes */
  57. /*
  58.  * Count the number of joysticks attached to the system
  59.  */
  60. static inline DECLSPEC int SDL_NumJoysticks(void)
  61. {
  62.     return 0;
  63. }
  64.  
  65. /*
  66.  * Get the implementation dependent name of a joystick.
  67.  * This can be called before any joysticks are opened.
  68.  * If no name can be found, this function returns NULL.
  69.  */
  70. static inline DECLSPEC const char *SDL_JoystickName(int device_index)
  71. {
  72.     return NULL;
  73. }
  74.  
  75. /*
  76.  * Open a joystick for use - the index passed as an argument refers to
  77.  * the N'th joystick on the system.  This index is the value which will
  78.  * identify this joystick in future joystick events.
  79.  *
  80.  * This function returns a joystick identifier, or NULL if an error occurred.
  81.  */
  82. static inline DECLSPEC SDL_Joystick *SDL_JoystickOpen(int device_index)
  83. {
  84.     return NULL;
  85. }
  86.  
  87. /*
  88.  * Returns 1 if the joystick has been opened, or 0 if it has not.
  89.  */
  90. static inline DECLSPEC int SDL_JoystickOpened(int device_index)
  91. {
  92.     return 0;
  93. }
  94.  
  95. /*
  96.  * Get the device index of an opened joystick.
  97.  */
  98. static inline DECLSPEC int SDL_JoystickIndex(SDL_Joystick *joystick)
  99. {
  100.     return -1;
  101. }
  102.  
  103. /*
  104.  * Get the number of general axis controls on a joystick
  105.  */
  106. static inline DECLSPEC int SDL_JoystickNumAxes(SDL_Joystick *joystick)
  107. {
  108.     return -1;
  109. }
  110.  
  111. /*
  112.  * Get the number of trackballs on a joystick
  113.  * Joystick trackballs have only relative motion events associated
  114.  * with them and their state cannot be polled.
  115.  */
  116. static inline DECLSPEC int SDL_JoystickNumBalls(SDL_Joystick *joystick)
  117. {
  118.     return -1;
  119. }
  120.  
  121. /*
  122.  * Get the number of POV hats on a joystick
  123.  */
  124. static inline DECLSPEC int SDL_JoystickNumHats(SDL_Joystick *joystick)
  125. {
  126.     return -1;
  127. }
  128.  
  129. /*
  130.  * Get the number of buttons on a joystick
  131.  */
  132. static inline DECLSPEC int SDL_JoystickNumButtons(SDL_Joystick *joystick)
  133. {
  134.     return -1;
  135. }
  136.  
  137. /*
  138.  * Update the current state of the open joysticks.
  139.  * This is called automatically by the event loop if any joystick
  140.  * events are enabled.
  141.  */
  142. static inline DECLSPEC void SDL_JoystickUpdate(void)
  143. {
  144.     /* STUB! */
  145. }
  146.  
  147. /*
  148.  * Enable/disable joystick event polling.
  149.  * If joystick events are disabled, you must call SDL_JoystickUpdate()
  150.  * yourself and check the state of the joystick when you want joystick
  151.  * information.
  152.  * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
  153.  */
  154. static inline DECLSPEC int SDL_JoystickEventState(int state)
  155. {
  156.     return SDL_IGNORE;
  157. }
  158.  
  159. /*
  160.  * Get the current state of an axis control on a joystick
  161.  * The state is a value ranging from -32768 to 32767.
  162.  * The axis indices start at index 0.
  163.  */
  164. static inline DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
  165. {
  166.     return -1;
  167. }
  168.  
  169. /*
  170.  * Get the current state of a POV hat on a joystick
  171.  * The return value is one of the following positions:
  172.  */
  173. #define SDL_HAT_CENTERED        0x00
  174. #define SDL_HAT_UP              0x01
  175. #define SDL_HAT_RIGHT           0x02
  176. #define SDL_HAT_DOWN            0x04
  177. #define SDL_HAT_LEFT            0x08
  178. #define SDL_HAT_RIGHTUP         (SDL_HAT_RIGHT|SDL_HAT_UP)
  179. #define SDL_HAT_RIGHTDOWN       (SDL_HAT_RIGHT|SDL_HAT_DOWN)
  180. #define SDL_HAT_LEFTUP          (SDL_HAT_LEFT|SDL_HAT_UP)
  181. #define SDL_HAT_LEFTDOWN        (SDL_HAT_LEFT|SDL_HAT_DOWN)
  182. /*
  183.  * The hat indices start at index 0.
  184.  */
  185. static inline DECLSPEC Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
  186. {
  187.     return 0;
  188. }
  189.  
  190. /*
  191.  * Get the ball axis change since the last poll
  192.  * This returns 0, or -1 if you passed it invalid parameters.
  193.  * The ball indices start at index 0.
  194.  */
  195. static inline DECLSPEC int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
  196. {
  197.     return -1;
  198. }
  199. /*
  200.  * Get the current state of a button on a joystick
  201.  * The button indices start at index 0.
  202.  */
  203. static inline DECLSPEC Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button)
  204. {
  205.     return 0;
  206. }
  207.  
  208. /*
  209.  * Close a joystick previously opened with SDL_JoystickOpen()
  210.  */
  211. static inline DECLSPEC void SDL_JoystickClose(SDL_Joystick *joystick)
  212. {
  213.     /* STUB! */
  214. }
  215.  
  216. /* Ends C function definitions when using C++ */
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220. #include "close_code.h"
  221.  
  222. #endif /* _SDL_joystick_h */
  223.