00001
00007 #ifndef GAMEDXINPUT_H
00008 #define GAMEDXINPUT_H
00009
00010 #include "global.h"
00011
00012 #define KEYBUFFERSIZE 256
00013 #define KEYPRESS(name, key) (name[key] & 0x80)
00014
00021 class GameDXInput {
00022 public:
00026 GameDXInput();
00027
00031 ~GameDXInput();
00032
00038 void DITerm();
00039
00048 void SetupDI( HINSTANCE hInstance, HWND hwndMain );
00049
00053 void PollKeyboard();
00054
00062 bool IsKeyDown( int keyToCheck );
00063
00069 void PollMouse();
00070
00077 bool IsButtonDown( int Button );
00078
00085 POINT GetScreenPt();
00086
00093 POINT GetRelativePt();
00094
00098 POINT GameDXInput::GetWindowPt();
00099
00103 void ResetPos();
00104
00108 void CenterPos();
00109
00116 void CreateMouseSurf( LPDIRECT3DDEVICE8 m_pd3dDevice, char* pathName );
00117
00121 void ShowCursor( bool bShow, LPDIRECT3DDEVICE8 device );
00122
00126 void OnLostDevice();
00127
00131 void OnResetDevice();
00132
00133
00134 private:
00138 LPDIRECTINPUT8 m_pDI;
00139
00143 LPDIRECTINPUTDEVICE8 m_pDIKeyboard;
00144
00148 LPDIRECTINPUTDEVICE8 m_pMouseDev;
00149
00153 bool initialized;
00154
00158 DIMOUSESTATE m_MouseData;
00159
00163 bool m_bMousePollSuccess;
00164
00168 char m_KeyBuffer[KEYBUFFERSIZE];
00169
00173 bool m_bKeyPollSuccess;
00174
00178 LPDIRECT3DSURFACE8 m_pCursorSurf;
00179 };
00180
00181 #endif