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); } }
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; } } }
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; } } }
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; }
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; }