2 * psychlops_io_API_Win32.cpp
\r
3 * Psychlops Standard Library (Win32)
\r
5 * Last Modified 2006/01/05 by Kenchi HOSOKAWA
\r
6 * (C) 2005 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO
\r
12 #include <windows.h>
\r
15 #include "psychlops_io_API_Win32.h"
16 #define PSYCHLOPS_WINDOW_API_PLATFORM
17 #include "../../platform/psychlops_platform_selector.h"
\r
18 #include "../../core/devices/psychlops_io_hid.h"
\r
19 #include "../../core/devices/psychlops_io_display.h"
\r
20 #include "../../core/graphic/psychlops_g_canvas.h"
\r
21 #include "../../extension/standard/widgets/psychlops_widgets_event.h"
\r
22 #include "../../core/ApplicationInterfaces/psychlops_code_exception.h"
\r
25 namespace Psychlops {
\r
27 typedef HumanInterfaceDevice HID;
29 HANDLE APIHIDProperties::io_thread;
\r
30 DWORD APIHIDProperties::io_threadID;
\r
31 HDC APIHIDProperties::the_display_; // Handle for dummy Device Context
\r
32 WNDCLASSEX APIHIDProperties::wcx; // Handle for dummy WindowClassEx
\r
33 HWND APIHIDProperties::hWnd; // Handle for dummy Window
\r
35 bool APIHIDProperties::refresh_needed = false;
\r
38 // Event Based Keyboard-Accept Code
\r
39 void APIHIDProperties::initialize() {
40 for(int i=0; i<4; i++) for(int j=0; j<keycnt_; j++) states_[i][j] = 0;
42 // io_thread = CreateThread(NULL, 0, &setupListener, NULL, 0, &io_threadID);
\r
44 void APIHIDProperties::finalize() {
45 // io_thread = CreateThread(NULL, 0, &setupListener, NULL, 0, &io_threadID);
47 /* DWORD WINAPI APIHIDProperties::setupListener(LPVOID vdParam) {
\r
48 wcx.cbSize = sizeof(WNDCLASSEX);
\r
50 wcx.lpfnWndProc = (WNDPROC)&(APIApplicationProperties::proc);
\r
53 wcx.hInstance = APIApplicationProperties::startupinfo.hInstance_;
\r
57 wcx.hbrBackground = NULL;
\r
58 wcx.lpszMenuName = "Psychlops Input Listner";
\r
59 wcx.lpszClassName = "PsychlopsInputListner";
\r
60 if (!RegisterClassEx(&wcx)) throw Exception(typeid(APIHIDProperties), "API ERROR", "Failed to regist control message listner.");
\r
62 hWnd = CreateWindowEx( NULL, "PsychlopsInputListner", "Psychlops Dummy Window", NULL, 0,0,0,0, HWND_MESSAGE, NULL, wcx.hInstance, NULL);
\r
63 if(hWnd==NULL) throw Exception(typeid(APIHIDProperties), "API ERROR", "Failed to regist control message listner.");
\r
66 PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
\r
68 Keyboard::initialize();
\r
69 Mouse::initialize();
\r
71 SetThreadPriority(io_thread, THREAD_PRIORITY_LOWEST);
\r
75 void APIHIDProperties::startListener() {
\r
76 // SetThreadPriority(io_thread, THREAD_PRIORITY_BELOW_NORMAL);
\r
78 void APIHIDProperties::stopListener() {
\r
79 // SetThreadPriority(io_thread, THREAD_PRIORITY_LOWEST);
\r
81 void APIHIDProperties::listen() {
\r
83 Events::MouseLeftDown mouseLeftDown;
\r
84 Events::MouseLeftUp mouseLeftUp;
\r
85 Events::KeyDown keyDown;
\r
86 Events::KeyUp keyUp;
\r
89 POINT mouse_global_p;
\r
90 while(0!=PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)){
91 GetMessage(&msg, NULL, 0 ,0);
\r
92 GetCursorPos(&mouse_global_p);
\r
93 Mouse::uniX.val_ = mouse_global_p.x;
\r
94 Mouse::uniY.val_ = mouse_global_p.y;
95 switch( msg.message ) {
\r
97 if ( msg.wParam==VK_F4 ) PostQuitMessage(0);
\r
100 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
101 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
103 case WM_LBUTTONDOWN:
\r
104 HID::state[HID::pushed].button[Mouse::left.code] = true;
\r
105 HID::state[HID::pressed].button[Mouse::left.code] = true;
106 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
107 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
108 if(Display::the_canvas!=0) {
\r
109 pp = Display::the_canvas->mouse();
\r
110 mouseLeftDown.place = pp;
\r
111 mouseLeftDown.time = msg.time;
\r
112 Display::the_canvas->eventroot.distribute(mouseLeftDown);
\r
116 HID::state[HID::released].button[Mouse::left.code] = true;
\r
117 HID::state[HID::pressed].button[Mouse::left.code] = false;
118 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
119 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
120 if(Display::the_canvas!=0) {
\r
121 pp = Display::the_canvas->mouse();
\r
122 mouseLeftUp.place = pp;
\r
123 mouseLeftUp.time = msg.time;
\r
124 Display::the_canvas->eventroot.distribute(mouseLeftUp);
\r
127 case WM_RBUTTONDOWN:
\r
128 HID::state[HID::pushed].button[Mouse::right.code] = true;
\r
129 HID::state[HID::pressed].button[Mouse::right.code] = true;
130 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
131 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
134 HID::state[HID::released].button[Mouse::right.code] = true;
\r
135 HID::state[HID::pressed].button[Mouse::right.code] = false;
136 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
137 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
139 case WM_MBUTTONDOWN:
\r
140 HID::state[HID::pushed].button[Mouse::middle.code] = true;
\r
141 HID::state[HID::pressed].button[Mouse::middle.code] = true;
142 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
143 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
146 HID::state[HID::released].button[Mouse::middle.code] = true;
\r
147 HID::state[HID::pressed].button[Mouse::middle.code] = false;
148 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
149 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
151 case WM_MOUSEHOVER:
\r
152 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
\r
153 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
155 case WM_MOUSELEAVE:
\r
156 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
\r
157 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
\r
160 HID::state[HID::pushed].key[msg.wParam] = true;
161 HID::state[HID::pressed].key[msg.wParam] = true;
\r
162 /*if(Display::the_canvas!=0) {
\r
164 keyDown.time = msg.time;
\r
165 Display::the_canvas->eventroot.distribute(keyDown);
\r
169 HID::state[HID::released].key[msg.wParam] = true;
170 HID::state[HID::pressed].key[msg.wParam] = false;
\r
171 /*if(Display::the_canvas!=0) {
\r
173 keyUp.time = msg.time;
\r
174 Display::the_canvas->eventroot.distribute(keyUp);
\r
178 Mouse::wheelDelta.y -= (short)HIWORD(msg.wParam);
179 //Mouse::uniX.val_ = (SHORT)LOWORD(msg.lParam);
180 //Mouse::uniY.val_ = (SHORT)HIWORD(msg.lParam);
188 TranslateMessage(&msg);
\r
189 DispatchMessage(&msg);
\r
195 void APIHIDProperties::update()
\r
202 memcpy(reinterpret_cast<void *>(states_[HID::hadpressed]), reinterpret_cast<const void *>(states_[HID::pressed]), keycnt_);
203 GetKeyboardState(states_[Keyboard::pressed]);
204 for(int i=0; i<keycnt_; i++) {
205 tmp = states_[Keyboard::pressed][i] ^ states_[Keyboard::hadpressed][i];
206 states_[HID::pushed][i] |= tmp & states_[HID::pressed][i];
207 states_[HID::released][i] |= tmp & states_[HID::hadpressed][i];
211 GetCursorPos(&point);
212 Mouse::uniX.val_ = point.x;
213 Mouse::uniY.val_ = point.y;
216 void APIHIDProperties::updatePointerPosition() {
\r
218 GetCursorPos(&point);
\r
219 Mouse::uniX.val_ = point.x;
\r
220 Mouse::uniY.val_ = point.y;
\r
224 bool APIHIDProperties::get(Mouse::Button button, Mouse::ButtonState state) {
225 APIHIDProperties::listen();
226 bool val = HID::state[state].button[button.code];
227 if(state!=Mouse::pressed) HID::state[(HID::ButtonState)state].button[button.code] = false;
230 bool APIHIDProperties::get(Keyboard::Key key, Keyboard::KeyState state) {
231 APIHIDProperties::listen();
232 bool val = HID::state[state].key[keybinder_[key.code]];
233 if(state!=Keyboard::pressed) HID::state[(HID::ButtonState)state].key[keybinder_[key.code]] = false;
237 if(state==Keyboard::pressed) {
238 return pressedbit_ & states_[state][keybinder_[key.code]];
241 tmp = pressedbit_ & states_[state][keybinder_[key.code]];
242 states_[state][keybinder_[key.code]] = 0;
246 void APIHIDProperties::setPointerPosition(int x, int y) {
252 one=0,two,three,four,five,six,seven,eight,nine,zero,
253 a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,
255 pad0,pad1,pad2,pad3,pad4,pad5,pad6,pad7,pad8,pad9,
256 rtn,spc,esc,tab,up,down,left,right,
258 shift=100, shift_r, ctrl, alt,
260 hyphen=59,equal,backslash,caret,
261 underscore,semicolon,colon,leftbracket,rightbracket,at, // because these keys laid on different location in differnt keyboard-lacalization.
262 padcomma,padperiod,padenter,padplus,padminus,padasterisk,padslash,padequal,padclear, // because these keys are OS-specific.
263 nfer,xfer // because these keys exist only on Japanese keyboard
266 void APIHIDProperties::bindKeyCode() {
267 keybinder_[Keyboard_::shift] = VK_SHIFT;
268 keybinder_[Keyboard_::ctrl] = VK_CONTROL;
269 keybinder_[Keyboard_::alt] = VK_MENU;
272 keybinder_[Keyboard_::pad0] = 0x60;
273 keybinder_[Keyboard_::pad1] = 0x61;
274 keybinder_[Keyboard_::pad2] = 0x62;
275 keybinder_[Keyboard_::pad3] = 0x63;
276 keybinder_[Keyboard_::pad4] = 0x64;
277 keybinder_[Keyboard_::pad5] = 0x65;
278 keybinder_[Keyboard_::pad6] = 0x66;
279 keybinder_[Keyboard_::pad7] = 0x67;
280 keybinder_[Keyboard_::pad8] = 0x68;
281 keybinder_[Keyboard_::pad9] = 0x69;
282 keybinder_[Keyboard_::padslash] = 0x6F;
283 keybinder_[Keyboard_::padplus] = 0x6B;
284 keybinder_[Keyboard_::padminus] = 0x6D;
285 keybinder_[Keyboard_::padasterisk] = 0x6A;
287 //keybinder_[Keyboard_::padcomma] = 2;
288 //keybinder_[Keyboard_::padcomma] = 128;
289 //keybinder_[Keyboard_::padperiod] = 2;
290 //keybinder_[Keyboard_::padperiod] = 33554432L;
291 //keybinder_[Keyboard_::padenter] = 2;
292 //keybinder_[Keyboard_::padenter] = 1048576L;
294 //keybinder_[Keyboard_::padequal] = 2;
295 //keybinder_[Keyboard_::padequal] = 512;
296 //keybinder_[Keyboard_::padclear] = 2;
297 //keybinder_[Keyboard_::padclear] = 2147483648UL;
299 keybinder_[Keyboard_::one] = 0x31;
300 keybinder_[Keyboard_::two] = 0x32;
301 keybinder_[Keyboard_::three] = 0x33;
302 keybinder_[Keyboard_::four] = 0x34;
303 keybinder_[Keyboard_::five] = 0x35;
304 keybinder_[Keyboard_::six] = 0x36;
305 keybinder_[Keyboard_::seven] = 0x37;
306 keybinder_[Keyboard_::eight] = 0x38;
307 keybinder_[Keyboard_::nine] = 0x39;
308 keybinder_[Keyboard_::zero] = 0x30;
309 keybinder_[Keyboard_::hyphen] = 0xBD;
310 keybinder_[Keyboard_::caret] = 1;
311 keybinder_[Keyboard_::backslash] = 0xDC;
313 keybinder_[Keyboard_::q] = 0x51;
314 keybinder_[Keyboard_::w] = 0x57;
315 keybinder_[Keyboard_::e] = 0x45;
316 keybinder_[Keyboard_::r] = 0x52;
317 keybinder_[Keyboard_::t] = 0x54;
318 keybinder_[Keyboard_::y] = 0x59;
319 keybinder_[Keyboard_::u] = 0x55;
320 keybinder_[Keyboard_::i] = 0x49;
321 keybinder_[Keyboard_::o] = 0x4F;
322 keybinder_[Keyboard_::p] = 0x50;
323 keybinder_[Keyboard_::at] = 33554432L;
324 keybinder_[Keyboard_::leftbracket] = 0xDB;
326 keybinder_[Keyboard_::a] = 0x41;
327 keybinder_[Keyboard_::s] = 0x53;
328 keybinder_[Keyboard_::d] = 0x44;
329 keybinder_[Keyboard_::f] = 0x46;
330 keybinder_[Keyboard_::g] = 0x47;
331 keybinder_[Keyboard_::h] = 0x48;
332 keybinder_[Keyboard_::j] = 0x4A;
333 keybinder_[Keyboard_::k] = 0x4B;
334 keybinder_[Keyboard_::l] = 0x4C;
335 keybinder_[Keyboard_::semicolon] = 0xBA;
336 keybinder_[Keyboard_::colon] = 0xBA;
337 keybinder_[Keyboard_::rightbracket] = 0xDD;
339 keybinder_[Keyboard_::z] = 0x5A;
340 keybinder_[Keyboard_::x] = 0x58;
341 keybinder_[Keyboard_::c] = 0x43;
342 keybinder_[Keyboard_::v] = 0x56;
343 keybinder_[Keyboard_::b] = 0x42;
344 keybinder_[Keyboard_::n] = 0x4E;
345 keybinder_[Keyboard_::m] = 0x4D;
346 keybinder_[Keyboard_::comma] = 0xBC;
347 keybinder_[Keyboard_::period] = 0xBE;
348 keybinder_[Keyboard_::slash] = 0xBF;
349 keybinder_[Keyboard_::underscore] = 64;
351 keybinder_[Keyboard_::esc] = VK_ESCAPE;
352 keybinder_[Keyboard_::rtn] = VK_RETURN;
\r
353 keybinder_[Keyboard_::tab] = VK_TAB;
354 keybinder_[Keyboard_::spc] = 0x20;
355 keybinder_[Keyboard_::up] = 0x26;
356 keybinder_[Keyboard_::down] = 0x28;
357 keybinder_[Keyboard_::left] = 0x25;
358 keybinder_[Keyboard_::right] = 0x27;
361 unsigned long APIHIDProperties::keybinder_[keycnt_];
362 BYTE APIHIDProperties::states_[4][keycnt_];
366 unsigned long APIKeyboardProperties::keybinder_[keycnt_];
\r
367 BYTE APIKeyboardProperties::states_[4][keycnt_];
\r
369 bool APIKeyboardProperties::get(Keyboard::Key key, Keyboard::KeyState state) {
\r
370 APIHIDProperties::listen();
\r
372 if(state==Keyboard::pressed) {
\r
373 return pressedbit_ & states_[state][keybinder_[key.code]];
\r
376 tmp = pressedbit_ & states_[state][keybinder_[key.code]];
\r
377 states_[state][keybinder_[key.code]] = 0;
\r
382 void APIKeyboardProperties::update() {
\r
384 memcpy(reinterpret_cast<void *>(states_[Keyboard::hadpressed]), reinterpret_cast<const void *>(states_[Keyboard::pressed]), keycnt_);
\r
385 GetKeyboardState(states_[Keyboard::pressed]);
\r
386 for(int i=0; i<keycnt_; i++) {
\r
387 tmp = states_[Keyboard::pressed][i] ^ states_[Keyboard::hadpressed][i];
\r
388 states_[Keyboard::pushed][i] |= tmp & states_[Keyboard::pressed][i];
\r
389 states_[Keyboard::released][i] |= tmp & states_[Keyboard::hadpressed][i];
\r
393 void APIKeyboardProperties::refresh() {
\r
394 for(int i=0; i<keycnt_; i++) {
\r
395 states_[Keyboard::pushed][i] = 0;
\r
396 states_[Keyboard::released][i] = 0;
\r
402 void APIKeyboardProperties::initialize() {
\r
403 //memset(states_, 4*keycnt_, 0);
\r
404 for(int i=0; i<4; i++) for(int j=0; j<keycnt_; j++) states_[i][j] = 0;
\r
411 one,two,three,four,five,six,seven,eight,nine,zero,
412 a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,
414 pad0,pad1,pad2,pad3,pad4,pad5,pad6,pad7,pad8,pad9,
415 rtn,spc,esc,up,down,left,right,
419 hyphen,equal,backslash,caret,
420 underscore,semicolon,colon,leftbracket,rightbracket,at, // because these keys laid on different location in differnt keyboard-lacalization.
421 padcomma,padperiod,padenter,padplus,padminus,padasterisk,padslash,padequal,padclear // because these keys are OS-specific.
424 void APIKeyboardProperties::bindKeyCode() {
\r
425 keybinder_[Keyboard_::shift] = VK_SHIFT;
\r
426 keybinder_[Keyboard_::ctrl] = 0x11;
\r
427 keybinder_[Keyboard_::alt] = VK_MENU;
\r
430 keybinder_[Keyboard_::pad0] = 0x60;
\r
431 keybinder_[Keyboard_::pad1] = 0x61;
\r
432 keybinder_[Keyboard_::pad2] = 0x62;
\r
433 keybinder_[Keyboard_::pad3] = 0x63;
\r
434 keybinder_[Keyboard_::pad4] = 0x64;
\r
435 keybinder_[Keyboard_::pad5] = 0x65;
\r
436 keybinder_[Keyboard_::pad6] = 0x66;
\r
437 keybinder_[Keyboard_::pad7] = 0x67;
\r
438 keybinder_[Keyboard_::pad8] = 0x68;
\r
439 keybinder_[Keyboard_::pad9] = 0x69;
\r
440 keybinder_[Keyboard_::padslash] = 0x6F;
\r
441 keybinder_[Keyboard_::padplus] = 0x6B;
\r
442 keybinder_[Keyboard_::padminus] = 0x6D;
\r
443 keybinder_[Keyboard_::padasterisk] = 0x6A;
\r
445 //keybinder_[Keyboard_::padcomma] = 2;
\r
446 //keybinder_[Keyboard_::padcomma] = 128;
\r
447 //keybinder_[Keyboard_::padperiod] = 2;
\r
448 //keybinder_[Keyboard_::padperiod] = 33554432L;
\r
449 //keybinder_[Keyboard_::padenter] = 2;
\r
450 //keybinder_[Keyboard_::padenter] = 1048576L;
\r
452 //keybinder_[Keyboard_::padequal] = 2;
\r
453 //keybinder_[Keyboard_::padequal] = 512;
\r
454 //keybinder_[Keyboard_::padclear] = 2;
\r
455 //keybinder_[Keyboard_::padclear] = 2147483648UL;
\r
457 keybinder_[Keyboard_::one] = 0x31;
\r
458 keybinder_[Keyboard_::two] = 0x32;
\r
459 keybinder_[Keyboard_::three] = 0x33;
\r
460 keybinder_[Keyboard_::four] = 0x34;
\r
461 keybinder_[Keyboard_::five] = 0x35;
\r
462 keybinder_[Keyboard_::six] = 0x36;
\r
463 keybinder_[Keyboard_::seven] = 0x37;
\r
464 keybinder_[Keyboard_::eight] = 0x38;
\r
465 keybinder_[Keyboard_::nine] = 0x39;
\r
466 keybinder_[Keyboard_::zero] = 0x30;
\r
467 keybinder_[Keyboard_::hyphen] = 0xBD;
\r
468 keybinder_[Keyboard_::caret] = 1;
\r
469 keybinder_[Keyboard_::backslash] = 0xDC;
\r
471 keybinder_[Keyboard_::q] = 0x51;
\r
472 keybinder_[Keyboard_::w] = 0x57;
\r
473 keybinder_[Keyboard_::e] = 0x45;
\r
474 keybinder_[Keyboard_::r] = 0x52;
\r
475 keybinder_[Keyboard_::t] = 0x54;
\r
476 keybinder_[Keyboard_::y] = 0x59;
\r
477 keybinder_[Keyboard_::u] = 0x55;
\r
478 keybinder_[Keyboard_::i] = 0x49;
\r
479 keybinder_[Keyboard_::o] = 0x4F;
\r
480 keybinder_[Keyboard_::p] = 0x50;
\r
481 keybinder_[Keyboard_::at] = 33554432L;
\r
482 keybinder_[Keyboard_::leftbracket] = 0xDB;
\r
484 keybinder_[Keyboard_::a] = 0x41;
\r
485 keybinder_[Keyboard_::s] = 0x53;
\r
486 keybinder_[Keyboard_::d] = 0x44;
\r
487 keybinder_[Keyboard_::f] = 0x46;
\r
488 keybinder_[Keyboard_::g] = 0x47;
\r
489 keybinder_[Keyboard_::h] = 0x48;
\r
490 keybinder_[Keyboard_::j] = 0x4A;
\r
491 keybinder_[Keyboard_::k] = 0x4B;
\r
492 keybinder_[Keyboard_::l] = 0x4C;
\r
493 keybinder_[Keyboard_::semicolon] = 0xBA;
\r
494 keybinder_[Keyboard_::colon] = 0xBA;
\r
495 keybinder_[Keyboard_::rightbracket] = 0xDD;
\r
497 keybinder_[Keyboard_::z] = 0x5A;
\r
498 keybinder_[Keyboard_::x] = 0x58;
\r
499 keybinder_[Keyboard_::c] = 0x43;
\r
500 keybinder_[Keyboard_::v] = 0x56;
\r
501 keybinder_[Keyboard_::b] = 0x42;
\r
502 keybinder_[Keyboard_::n] = 0x4E;
\r
503 keybinder_[Keyboard_::m] = 0x4D;
\r
504 keybinder_[Keyboard_::comma] = 0xBC;
\r
505 keybinder_[Keyboard_::period] = 0xBE;
\r
506 keybinder_[Keyboard_::slash] = 0xBF;
\r
507 keybinder_[Keyboard_::underscore] = 64;
\r
509 keybinder_[Keyboard_::esc] = 0x1B;
\r
510 keybinder_[Keyboard_::rtn] = 0x0D;
\r
511 keybinder_[Keyboard_::spc] = 0x20;
\r
512 keybinder_[Keyboard_::up] = 0x26;
\r
513 keybinder_[Keyboard_::down] = 0x28;
\r
514 keybinder_[Keyboard_::left] = 0x25;
\r
515 keybinder_[Keyboard_::right] = 0x27;
\r
520 bool APIMouseProperties::buttonstate_[4][3];
\r
521 POINT APIMouseProperties::position_;
\r
524 void APIMouseProperties::getPosition(int &x, int &y) {
\r
525 //APIInputProperties::listen();
\r
529 void APIMouseProperties::setPosition(int x, int y) {
\r
533 void APIMouseProperties::initialize() {
\r
537 void APIMouseProperties::update() {
\r
538 GetCursorPos(&position_);
\r
540 void APIMouseProperties::refresh() {
\r
541 for(int i=0; i<4; i++) for(int j=0; j<3; j++) buttonstate_[i][j] = false;
\r
544 bool APIMouseProperties::get(Mouse::Button button, Mouse::ButtonState state) {
\r
545 APIHIDProperties::listen();
\r
546 bool val = buttonstate_[state][button.code];
\r
548 case Mouse::pushed:
\r
549 case Mouse::released:
\r
550 buttonstate_[state][button.code] = false;
\r
557 } /* <- namespace Psycholops */
\r