00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_JOYSTICK_HANDLER_H_
00028 #define OSDL_JOYSTICK_HANDLER_H_
00029
00030
00031
00032 #include "OSDLInputDeviceHandler.h"
00033 #include "OSDLJoystickCommon.h"
00034
00035
00036 #include <string>
00037 #include <list>
00038
00039
00040
00041
00042 namespace OSDL
00043 {
00044
00045
00046
00047 namespace MVC
00048 {
00049
00050
00051
00052
00053
00054
00055 class Controller ;
00056
00057 }
00058
00059
00060
00061 namespace Events
00062 {
00063
00064
00065
00066
00067 class Joystick ;
00068
00069
00070
00071
00082 class OSDL_DLL JoystickHandler: public InputDeviceHandler
00083 {
00084
00085
00086
00087
00088
00089
00090
00091 friend class OSDL::Events::EventsModule ;
00092
00093
00094
00095 public:
00096
00097
00098
00113 explicit JoystickHandler( bool useClassicalJoysticks = true ) ;
00114
00115
00116
00121 virtual ~JoystickHandler() throw() ;
00122
00123
00124
00131 virtual void update() ;
00132
00133
00134
00146 virtual void openJoystick( JoystickNumber index ) ;
00147
00148
00149
00167 virtual void linkToController( JoystickNumber index,
00168 OSDL::MVC::Controller & controller ) ;
00169
00170
00171
00183 virtual const std::string toString(
00184 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00185
00186
00187
00188
00189
00190
00191
00192
00198 static JoystickNumber GetAvailableJoystickCount() ;
00199
00200
00201
00202
00203 protected:
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00222 virtual void axisChanged(
00223 const JoystickAxisEvent & joystickEvent ) const ;
00224
00225
00226
00234 virtual void trackballChanged(
00235 const JoystickTrackballEvent & joystickEvent ) const ;
00236
00237
00238
00246 virtual void hatChanged(
00247 const JoystickHatEvent & joystickEvent ) const ;
00248
00249
00250
00258 virtual void buttonPressed(
00259 const JoystickButtonEvent & joystickEvent ) const ;
00260
00261
00262
00270 virtual void buttonReleased(
00271 const JoystickButtonEvent & joystickEvent ) const ;
00272
00273
00274
00280 virtual void blank() ;
00281
00282
00283
00293 virtual void checkJoystickAt( JoystickNumber index ) const ;
00294
00295
00296
00297
00302 JoystickNumber _joystickCount ;
00303
00304
00305
00315 Joystick ** _joysticks ;
00316
00317
00318
00324 bool _useClassicalJoysticks ;
00325
00326
00327
00328
00329 private:
00330
00331
00332
00341 explicit JoystickHandler( const JoystickHandler & source ) ;
00342
00343
00344
00353 JoystickHandler & operator = (
00354 const JoystickHandler & source ) ;
00355
00356
00357
00358 } ;
00359
00360
00361 }
00362
00363 }
00364
00365
00366
00367 #endif // OSDL_JOYSTICK_HANDLER_H_
00368