GetAsyncKeyState() private method

private GetAsyncKeyState ( VirtualKeys vKey ) : SHORT
vKey VirtualKeys
return SHORT
Ejemplo n.º 1
0
 void UpdateKeyboard()
 {
     for (byte i = 0; i < byte.MaxValue; i++)
     {
         bool pressed = (Functions.GetAsyncKeyState((VirtualKeys)i) >> 8) != 0;
         Key  key;
         KeyMap.TryGetValue((VirtualKeys)i, out key);
         keyboard.SetKeyState(key, i, pressed);
     }
 }
Ejemplo n.º 2
0
 private void UpdateKeyboard()
 {
     for (int index1 = 0; index1 < 256; ++index1)
     {
         VirtualKeys index2 = (VirtualKeys)index1;
         bool        flag   = (int)Functions.GetAsyncKeyState(index2) >> 8 != 0;
         if (this.KeyMap.ContainsKey(index2))
         {
             this.keyboard[this.KeyMap[index2]] = flag;
         }
     }
 }
Ejemplo n.º 3
0
 void UpdateKeyboard()
 {
     for (int i = 0; i < 256; i++)
     {
         VirtualKeys key     = (VirtualKeys)i;
         bool        pressed = (Functions.GetAsyncKeyState(key) >> 8) != 0;
         if (KeyMap.ContainsKey(key))
         {
             keyboard[KeyMap[key]] = pressed;
         }
     }
 }
Ejemplo n.º 4
0
        private void UpdateMouse()
        {
            POINT point = new POINT();

            Functions.GetCursorPos(ref point);
            this.mouse.X = point.X;
            this.mouse.Y = point.Y;
            this.mouse[MouseButton.Left]    = (int)Functions.GetAsyncKeyState(VirtualKeys.LBUTTON) >> 8 != 0;
            this.mouse[MouseButton.Middle]  = (int)Functions.GetAsyncKeyState(VirtualKeys.RBUTTON) >> 8 != 0;
            this.mouse[MouseButton.Right]   = (int)Functions.GetAsyncKeyState(VirtualKeys.MBUTTON) >> 8 != 0;
            this.mouse[MouseButton.Button1] = (int)Functions.GetAsyncKeyState(VirtualKeys.XBUTTON1) >> 8 != 0;
            this.mouse[MouseButton.Button2] = (int)Functions.GetAsyncKeyState(VirtualKeys.XBUTTON2) >> 8 != 0;
        }
Ejemplo n.º 5
0
        void UpdateMouse()
        {
            POINT p = new POINT();

            Functions.GetCursorPos(ref p);
            mouse.X = p.X;
            mouse.Y = p.Y;
            // Note: we cannot poll the mouse wheel
            mouse[MouseButton.Left]    = (Functions.GetAsyncKeyState(VirtualKeys.LBUTTON) >> 8) != 0;
            mouse[MouseButton.Middle]  = (Functions.GetAsyncKeyState(VirtualKeys.RBUTTON) >> 8) != 0;
            mouse[MouseButton.Right]   = (Functions.GetAsyncKeyState(VirtualKeys.MBUTTON) >> 8) != 0;
            mouse[MouseButton.Button1] = (Functions.GetAsyncKeyState(VirtualKeys.XBUTTON1) >> 8) != 0;
            mouse[MouseButton.Button2] = (Functions.GetAsyncKeyState(VirtualKeys.XBUTTON2) >> 8) != 0;
        }