My Project
GUIDirectInput.h
1 
2 #include "GUIBase.h"
3 #include "GUIResource.h"
4 #include "ParaEngine.h"
5 #include "GUIKeyboardVirtual.h"
6 #include "GUIMouseVirtual.h"
7 
8 namespace ParaEngine
9 {
10 #if defined(USE_DIRECTX_RENDERER)
11 
14  class CDirectKeyboard : public CGUIKeyboardVirtual
15  {
16  public:
17  CDirectKeyboard(HWND hDlg);
18  ~CDirectKeyboard(){Free();};
19 
20  HRESULT CreateDevice(HWND hDlg);
21  void Free();
22  virtual HRESULT ReadBufferedData( );
23  virtual HRESULT ReadImmediateData( );
24 
25  LPDIRECTINPUT8 m_pDI; // The DirectInput object
26  LPDIRECTINPUTDEVICE8 m_pKeyboard; // The keyboard device
27  };
28 
30  class CDirectMouse : public CGUIMouseVirtual
31  {
32  public:
33  CDirectMouse(HWND hDlg);
34  virtual ~CDirectMouse();
35  HRESULT CreateDevice(HWND hDlg);
36  void Free();
37  virtual HRESULT ReadBufferedData( );
38  virtual HRESULT ReadImmediateData();
39  virtual void Update();
40 
42  virtual void SetLock(bool bLock);
43 
45  virtual void ShowCursor(bool bShowCursor);
46 
48  virtual void ForceShowCursor(bool bShow);
49 
51  virtual void GetDeviceCursorPos(int& x, int&y);
52  virtual void SetDeviceCursorPos(int x, int y);
53 
54  virtual bool IsButtonDown(MOUSE_KEY_STD nMouseButton);
55 
63  void SetCursorFromFile(const char *szCursor, int XHotSpot=0, int YHotSpot=0);
64  /*
65  * get the current cursor file.
66  * @param pXHotSpot: if not NULL, it will return the hot spot X
67  * @param pYHotSpot: if not NULL, it will return the hot spot Y
68  * @return: the cursor file is returned.
69  */
70  const char* GetCursorFile(int * pXHotSpot=NULL, int* pYHotSpot=NULL);
71 
73  void SetCursorFont(SpriteFontEntity* pFont, Color defaultFontColor, DWORD dwTextFormat=DT_CENTER | DT_VCENTER);
75  void SetCursorText(const char16_t* wszText);
76 
78  void SetCursorTextA(const char* szText);
80  void SetCursorTexture( TextureEntity* pTexture, RECT* prcTexture, Color defaultTextureColor=0xffffffff );
82  virtual HRESULT RenderCursor(GUIState* pGUIState,float fElapsedTime);
83 
85  const std::string& GetCursorName() const;
86 
88  virtual void SetMousePosition(int x, int y);
89 
90  virtual void Reset();
91 
92  void ResetCursorPosition();
93  public:
94  HWND m_hwnd;// window handle of the default window
95  std::string m_szCursorName;//the name of the cursor file
96 
97  int m_XHotSpot, m_YHotSpot; // mouse hot spot.
98  LPDIRECTINPUT8 m_pDI; // The DirectInput object
99  LPDIRECTINPUTDEVICE8 m_pMouse; // The Mouse device
100  bool m_bShowCursor;
101 
102  protected:
103  bool m_bUseDirectInput;
104  };
105 #else
107  {
108  public:
109  CDirectKeyboard(HWND hDlg=0){};
110  };
111 
113  {
114  public:
115  CDirectMouse(HWND hDlg = 0){};
116  virtual ~CDirectMouse(){};
117  };
118 #endif
119 }
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: ManagedDef.h:18
Definition: GUIDirectInput.h:106
Definition: GUIDirectInput.h:112
base class for GUI mouse
Definition: GUIMouseVirtual.h:14
virtual HRESULT ReadBufferedData()
Definition: GUIKeyboardVirtual.cpp:79
virtual void Update()
read hardware buffer and immediate keyboard states to internal data structure.
Definition: GUIKeyboardVirtual.cpp:110
base class for keyboard system.
Definition: GUIKeyboardVirtual.h:12