00001
00010 #ifndef __JOYSTICKINPUT_H__
00011 #define __JOYSTICKINPUT_H__
00012
00013 #include "InputObject.h"
00014 #include "DirectInput/joystick.h"
00015
00020 #define NUM_BUTTONS 9
00021
00026 enum JoystickChannels {
00027 JC_AXIS_X = 0,
00028 JC_AXIS_Y = 1,
00029 JC_AXIS_Z = 2,
00030 JC_ROTATE_X = 3,
00031 JC_ROTATE_Y = 4,
00032 JC_ROTATE_Z = 5,
00033 JC_POV_X = 6,
00034 JC_POV_Y = 7,
00035 JC_SLIDER0 = 10,
00036 JC_SLIDER1 = 11,
00037 JC_BUTTON0 = 20,
00038 JC_BUTTON1 = 21,
00039 JC_BUTTON2 = 22,
00040 JC_BUTTON3 = 23,
00041 JC_BUTTON4 = 24,
00042 JC_BUTTON5 = 25,
00043 JC_BUTTON6 = 26,
00044 JC_BUTTON7 = 27,
00045 JC_BUTTON8 = 28
00046 };
00047
00049
00052 class JoystickInput : public InputObject
00053 {
00054 private:
00056 Joystick *joystick;
00057
00059 bool cherry;
00060
00062 bool buttons[NUM_BUTTONS];
00063
00065 DIJOYSTATE2 last_state;
00066
00067 public:
00069
00072 JoystickInput(unsigned int id);
00073
00075 ~JoystickInput();
00076
00078 void start();
00079
00081 void stop();
00082
00084
00088 unsigned int poll(EventVector *events);
00089 };
00090
00091 #endif