OSDN Git Service

first
[psychlops/cpp.git] / psychlops / platform / win32 / psychlops_io_API_Win32.h
1 /*\r
2  *  psychlops_io_API_Win32.h\r
3  *  Psychlops Standard Library (Win32)\r
4  *\r
5  *  Last Modified 2006/01/05 by Kenchi HOSOKAWA\r
6  *  (C) 2006 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO\r
7  */\r
8 \r
9 #ifndef HEADER_PSYCHLOPS_IO_API_WIN32\r
10 #define HEADER_PSYCHLOPS_IO_API_WIN32\r
11 \r
12 \r
13 #include <windows.h>\r
14 \r
15 #include "psychlops_io_clock_Win32.h"\r
16 #include "../win32gl/psychlops_g_API_win32gl.h"\r
17 #include "../../core/devices/psychlops_io_hid.h"\r
18 \r
19 \r
20 namespace Psychlops {\r
21 \r
22         class APIHIDProperties;\r
23         class APIKeyboardProperties;\r
24         class APIMouseProperties;\r
25         class APICanvasProperties;\r
26         class Mouse;\r
27         class Keyboard;\r
28         class HumanInterfaceDevice;\r
29 \r
30         class APIHIDProperties {\r
31                 friend class APICanvasProperties;\r
32                 friend class Mouse;\r
33                 friend class Keyboard;\r
34                 friend class HumanInterfaceDevice;\r
35 \r
36                 private:\r
37                 static HDC the_display_;                                                        //      Handle for dummy Device Context\r
38                 static WNDCLASSEX wcx;                          //      Handle for dummy WindowClassEx\r
39                 static HWND hWnd;                                               //      Handle for dummy Window\r
40                 static HANDLE io_thread;\r
41                 static DWORD io_threadID;\r
42                 static bool refresh_needed;\r
43 \r
44                 public:\r
45                 static void initialize();
46                 static void finalize();\r
47
48                 static void listen();\r
49                 //  Event Based Keyboard-Accept Code(Hibernated)\r
50                 //  static void setKeyboardListener();\r
51 //              static DWORD WINAPI setupListener(LPVOID vdParam);\r
52 //              static void loopListener();\r
53                 static void startListener();\r
54                 static void stopListener();
55                 static void bindKeyCode();
56
57                 static bool get(Keyboard::Key key, Keyboard::KeyState state);
58                 static bool get(Mouse::Button button, Mouse::ButtonState state);
59                 static void setPointerPosition(int x, int y);
60                 static void update();\r
61                 static void updatePointerPosition();
62
63
64                 private:
65                 static const int keycnt_ = 256;
66                 static const int pressedbit_ = 128;
67                 static unsigned long keybinder_[keycnt_];
68                 static BYTE states_[4][keycnt_];\r
69         };\r
70
71
72 /*\r
73         class APIKeyboardProperties {\r
74                 friend class APIMouseProperties;\r
75                 friend class APIApplicationProperties;\r
76                 friend class APICanvasProperties;\r
77 \r
78                 private:\r
79                 static const int keycnt_ = 256;\r
80                 static const int pressedbit_ = 128;\r
81                 static unsigned long keybinder_[keycnt_];\r
82                 static BYTE states_[4][keycnt_];\r
83 \r
84                 public:\r
85                 static void initialize();\r
86                 static void bindKeyCode();\r
87 \r
88                 static void update();\r
89                 static void refresh();\r
90 \r
91                 static bool get(Keyboard::Key key, Keyboard::KeyState state);\r
92         };\r
93 \r
94         class APIMouseProperties {\r
95                 friend class APIHIDProperties;\r
96 \r
97                 private:\r
98                 static bool buttonstate_[4][3];\r
99                 static ::POINT position_;\r
100                 static const int pressedbit_ = 128;\r
101 \r
102                 public:\r
103                 static void initialize();\r
104 \r
105                 static void update();\r
106                 static void refresh();\r
107 \r
108                 static bool get(Mouse::Button button, Mouse::ButtonState state);\r
109                 static void getPosition(int &x, int &y);\r
110                 static void setPosition(int x, int y);\r
111         };\r
112 */
113 \r
114 }       /*      <- namespace Psycholops         */\r
115 \r
116 #endif\r