00001
00002
00003
00004
00005
00006 #ifndef __JOYSTICK_H__
00007 #define __JOYSTICK_H__
00008
00009 #define DIRECTINPUT_VERSION 0x0800
00010 #include <dinput.h>
00011
00012 class Joystick
00013 {
00014 private:
00015 unsigned int deviceID;
00016 unsigned int deviceCounter;
00017
00018 LPDIRECTINPUT8 di;
00019 LPDIRECTINPUTDEVICE8 joystick;
00020
00021 public:
00022 Joystick(unsigned int deviceID);
00023 ~Joystick();
00024
00025 HRESULT deviceName(char* name);
00026
00027 HRESULT open();
00028 HRESULT close();
00029
00030 HRESULT poll(DIJOYSTATE2 *js);
00031
00032 BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* instance, VOID* context);
00033
00034
00035 static unsigned int deviceCount();
00036 };
00037
00038 BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* instance, VOID* context);
00039 BOOL CALLBACK countCallback(const DIDEVICEINSTANCE* instance, VOID* counter);
00040
00041 #endif