[Plib-cvs] plib/src/pw pwWindows.cxx,1.7,1.8
Brought to you by:
sjbaker
From: Nick M. <nm...@us...> - 2004-03-24 11:29:46
|
Update of /cvsroot/plib/plib/src/pw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1741/src/pw Modified Files: pwWindows.cxx Log Message: Added pwGetModifiers Index: pwWindows.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pw/pwWindows.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- pwWindows.cxx 24 Mar 2004 01:30:41 -0000 1.7 +++ pwWindows.cxx 24 Mar 2004 11:19:04 -0000 1.8 @@ -35,7 +35,7 @@ #include "pw.h" static int initialised = 0 ; - +static int modifiers = 0 ; static int origin [2] = { 0, 0 } ; static int size [2] = { 640, 480 } ; @@ -58,6 +58,16 @@ } +static void refreshModifiers () +{ + modifiers = 0 ; + + if( ( GetKeyState ( VK_SHIFT ) & 0x8000 ) != 0 ) modifiers |= PW_SHIFT ; + if( ( GetKeyState ( VK_CONTROL ) & 0x8000 ) != 0 ) modifiers |= PW_CTRL ; + if( ( GetKeyState ( VK_MENU ) & 0x8000 ) != 0 ) modifiers |= PW_ALT ; +} + + LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { int key = -1 ; @@ -67,6 +77,8 @@ static int lastx = 0 ; static int lasty = 0 ; + refreshModifiers () ; + switch (uMsg) { case WM_LBUTTONDOWN: @@ -362,6 +374,12 @@ } +int pwGetModifiers () +{ + return modifiers ; +} + + static void getEvents () { MSG msg; |