2 * psychlops_io_API_Win32.h
\r
3 * Psychlops Standard Library (Win32)
\r
5 * Last Modified 2006/01/05 by Kenchi HOSOKAWA
\r
6 * (C) 2006 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO
\r
9 #ifndef HEADER_PSYCHLOPS_IO_API_WIN32
\r
10 #define HEADER_PSYCHLOPS_IO_API_WIN32
\r
13 #include <windows.h>
\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
20 namespace Psychlops {
\r
22 class APIHIDProperties;
\r
23 class APIKeyboardProperties;
\r
24 class APIMouseProperties;
\r
25 class APICanvasProperties;
\r
28 class HumanInterfaceDevice;
\r
30 class APIHIDProperties {
\r
31 friend class APICanvasProperties;
\r
33 friend class Keyboard;
\r
34 friend class HumanInterfaceDevice;
\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
45 static void initialize();
46 static void finalize();
\r
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();
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();
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
73 class APIKeyboardProperties {
\r
74 friend class APIMouseProperties;
\r
75 friend class APIApplicationProperties;
\r
76 friend class APICanvasProperties;
\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
85 static void initialize();
\r
86 static void bindKeyCode();
\r
88 static void update();
\r
89 static void refresh();
\r
91 static bool get(Keyboard::Key key, Keyboard::KeyState state);
\r
94 class APIMouseProperties {
\r
95 friend class APIHIDProperties;
\r
98 static bool buttonstate_[4][3];
\r
99 static ::POINT position_;
\r
100 static const int pressedbit_ = 128;
\r
103 static void initialize();
\r
105 static void update();
\r
106 static void refresh();
\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
114 } /* <- namespace Psycholops */
\r