00001 /* 00002 SDL - Simple DirectMedia Layer 00003 Copyright (C) 1997-2009 Sam Lantinga 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 Sam Lantinga 00020 slouken@libsdl.org 00021 */ 00022 00027 #ifndef _SDL_joystick_h 00028 #define _SDL_joystick_h 00029 00030 #include "SDL_stdinc.h" 00031 #include "SDL_error.h" 00032 00033 #include "begin_code.h" 00034 /* Set up for C function definitions, even when using C++ */ 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00046 struct _SDL_Joystick; 00047 typedef struct _SDL_Joystick SDL_Joystick; 00048 00049 /* Function prototypes */ 00053 extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); 00054 00061 extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); 00062 00073 extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index); 00074 00078 extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); 00079 00083 extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); 00084 00088 extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); 00089 00096 extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); 00097 00101 extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); 00102 00106 extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); 00107 00114 extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); 00115 00125 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); 00126 00134 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); 00135 00141 #define SDL_HAT_CENTERED 0x00 00142 #define SDL_HAT_UP 0x01 00143 #define SDL_HAT_RIGHT 0x02 00144 #define SDL_HAT_DOWN 0x04 00145 #define SDL_HAT_LEFT 0x08 00146 #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) 00147 #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) 00148 #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) 00149 #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) 00150 00157 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); 00158 00166 extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); 00167 00173 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); 00174 00178 extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); 00179 00180 00181 /* Ends C function definitions when using C++ */ 00182 #ifdef __cplusplus 00183 } 00184 #endif 00185 #include "close_code.h" 00186 00187 #endif /* _SDL_joystick_h */