Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /// JOYSTICK STUB FOR Wolfenstein 3D port to KolibriOS
  2. /// Ported by maxcodehack and turbocat2001
  3.  
  4. /* Set up for C function definitions, even when using C++ */
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. /** @file SDL_joystick.h
  10.  *  @note In order to use these functions, SDL_Init() must have been called
  11.  *        with the SDL_INIT_JOYSTICK flag.  This causes SDL to scan the system
  12.  *        for joysticks, and load appropriate drivers.
  13.  */
  14.  
  15. /** The joystick structure used to identify an SDL joystick */
  16. struct _SDL_Joystick;
  17. typedef struct _SDL_Joystick SDL_Joystick;
  18.  
  19. /* Function prototypes */
  20. /**
  21.  * Count the number of joysticks attached to the system
  22.  */
  23.   int    SDL_NumJoysticks(void){};
  24.  
  25. /**
  26.  * Get the implementation dependent name of a joystick.
  27.  *
  28.  * This can be called before any joysticks are opened.
  29.  * If no name can be found, this function returns NULL.
  30.  */
  31.   const char *    SDL_JoystickName(int device_index){};
  32.  
  33. /**
  34.  * Open a joystick for use.
  35.  *
  36.  * @param[in] device_index
  37.  * The index passed as an argument refers to
  38.  * the N'th joystick on the system.  This index is the value which will
  39.  * identify this joystick in future joystick events.
  40.  *
  41.  * @return This function returns a joystick identifier, or NULL if an error occurred.
  42.  */
  43.   SDL_Joystick *    SDL_JoystickOpen(int device_index){};
  44.  
  45. /**
  46.  * Returns 1 if the joystick has been opened, or 0 if it has not.
  47.  */
  48.   int    SDL_JoystickOpened(int device_index){};
  49.  
  50. /**
  51.  * Get the device index of an opened joystick.
  52.  */
  53.   int    SDL_JoystickIndex(SDL_Joystick *joystick){};
  54.  
  55. /**
  56.  * Get the number of general axis controls on a joystick
  57.  */
  58.   int    SDL_JoystickNumAxes(SDL_Joystick *joystick){};
  59.  
  60. /**
  61.  * Get the number of trackballs on a joystick
  62.  *
  63.  * Joystick trackballs have only relative motion events associated
  64.  * with them and their state cannot be polled.
  65.  */
  66.   int    SDL_JoystickNumBalls(SDL_Joystick *joystick){};
  67.  
  68. /**
  69.  * Get the number of POV hats on a joystick
  70.  */
  71.   int    SDL_JoystickNumHats(SDL_Joystick *joystick){};
  72.  
  73. /**
  74.  * Get the number of buttons on a joystick
  75.  */
  76.   int    SDL_JoystickNumButtons(SDL_Joystick *joystick){};
  77.  
  78. /**
  79.  * Update the current state of the open joysticks.
  80.  *
  81.  * This is called automatically by the event loop if any joystick
  82.  * events are enabled.
  83.  */
  84.   void    SDL_JoystickUpdate(void){};
  85.  
  86. /**
  87.  * Enable/disable joystick event polling.
  88.  *
  89.  * If joystick events are disabled, you must call SDL_JoystickUpdate()
  90.  * yourself and check the state of the joystick when you want joystick
  91.  * information.
  92.  *
  93.  * @param[in] state The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
  94.  */
  95.   int    SDL_JoystickEventState(int state){};
  96.  
  97. /**
  98.  * Get the current state of an axis control on a joystick
  99.  *
  100.  * @param[in] axis The axis indices start at index 0.
  101.  *
  102.  * @return The state is a value ranging from -32768 to 32767.
  103.  */
  104.   int    SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis){};
  105.  
  106. /**
  107.  *  @name Hat Positions
  108.  *  The return value of SDL_JoystickGetHat() is one of the following positions:
  109.  */
  110. /*@{*/
  111. #define SDL_HAT_CENTERED        0x00
  112. #define SDL_HAT_UP              0x01
  113. #define SDL_HAT_RIGHT           0x02
  114. #define SDL_HAT_DOWN            0x04
  115. #define SDL_HAT_LEFT            0x08
  116. #define SDL_HAT_RIGHTUP         (SDL_HAT_RIGHT|SDL_HAT_UP)
  117. #define SDL_HAT_RIGHTDOWN       (SDL_HAT_RIGHT|SDL_HAT_DOWN)
  118. #define SDL_HAT_LEFTUP          (SDL_HAT_LEFT|SDL_HAT_UP)
  119. #define SDL_HAT_LEFTDOWN        (SDL_HAT_LEFT|SDL_HAT_DOWN)
  120. /*@}*/
  121.  
  122. /**
  123.  *  Get the current state of a POV hat on a joystick
  124.  *
  125.  *  @param[in] hat The hat indices start at index 0.
  126.  */
  127.   int    SDL_JoystickGetHat(SDL_Joystick *joystick, int hat){};
  128.  
  129. /**
  130.  * Get the ball axis change since the last poll
  131.  *
  132.  * @param[in] ball The ball indices start at index 0.
  133.  *
  134.  * @return This returns 0, or -1 if you passed it invalid parameters.
  135.  */
  136.   int    SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy){};
  137.  
  138. /**
  139.  * Get the current state of a button on a joystick
  140.  *
  141.  * @param[in] button The button indices start at index 0.
  142.  */
  143.   int    SDL_JoystickGetButton(SDL_Joystick *joystick, int button){};
  144.  
  145. /**
  146.  * Close a joystick previously opened with SDL_JoystickOpen()
  147.  */
  148.   void    SDL_JoystickClose(SDL_Joystick *joystick){};
  149.  
  150. /* Ends C function definitions when using C++ */
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154.