00001 #ifndef OSDL_JOYSTICK_HANDLER_H_
00002 #define OSDL_JOYSTICK_HANDLER_H_
00003
00004
00005
00006 #include "OSDLInputDeviceHandler.h"
00007 #include "OSDLJoystickCommon.h"
00008
00009
00010 #include <string>
00011 #include <list>
00012
00013
00014 namespace OSDL
00015 {
00016
00017
00018 namespace MVC
00019 {
00020
00021
00022
00023
00024
00025
00026 class Controller ;
00027
00028 }
00029
00030
00031 namespace Events
00032 {
00033
00034
00035
00036 class Joystick ;
00037
00038
00039
00050 class OSDL_DLL JoystickHandler : public InputDeviceHandler
00051 {
00052
00053
00054
00055
00056
00057
00058
00059 friend class OSDL::Events::EventsModule ;
00060
00061
00062 public:
00063
00064
00065
00080 explicit JoystickHandler( bool useClassicalJoysticks = true )
00081 throw( InputDeviceHandlerException ) ;
00082
00083
00088 virtual ~JoystickHandler() throw() ;
00089
00090
00097 virtual void update() throw() ;
00098
00099
00111 virtual void openJoystick( JoystickNumber index )
00112 throw( JoystickException ) ;
00113
00114
00132 virtual void linkToController( JoystickNumber index,
00133 OSDL::MVC::Controller & controller )
00134 throw( JoystickException ) ;
00135
00136
00148 virtual const std::string toString(
00149 Ceylan::VerbosityLevels level = Ceylan::high )
00150 const throw() ;
00151
00152
00153
00154
00155
00156
00162 static JoystickNumber GetAvailableJoystickCount() throw() ;
00163
00164
00165
00166
00167 protected :
00168
00169
00170
00171
00172
00173
00174
00175
00176
00184 virtual void axisChanged(
00185 const JoystickAxisEvent & joystickEvent ) const throw() ;
00186
00187
00195 virtual void trackballChanged(
00196 const JoystickTrackballEvent & joystickEvent )
00197 const throw() ;
00198
00199
00207 virtual void hatChanged(
00208 const JoystickHatEvent & joystickEvent ) const throw() ;
00209
00210
00211
00219 virtual void buttonPressed(
00220 const JoystickButtonEvent & joystickEvent ) const throw() ;
00221
00222
00230 virtual void buttonReleased(
00231 const JoystickButtonEvent & joystickEvent ) const throw() ;
00232
00233
00234
00240 virtual void blank() throw() ;
00241
00242
00252 virtual void checkJoystickAt( JoystickNumber index )
00253 const throw() ;
00254
00255
00260 JoystickNumber _joystickCount ;
00261
00262
00272 Joystick ** _joysticks ;
00273
00274
00280 bool _useClassicalJoysticks ;
00281
00282
00283
00284 private:
00285
00286
00295 explicit JoystickHandler( const JoystickHandler & source )
00296 throw() ;
00297
00298
00307 JoystickHandler & operator = (
00308 const JoystickHandler & source ) throw() ;
00309
00310
00311 } ;
00312
00313 }
00314
00315 }
00316
00317
00318
00319 #endif // OSDL_JOYSTICK_HANDLER_H_