From 142b8cc2e9bb2d8c219a3b914ffbd9bdb8d65643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Mon, 12 Dec 2022 11:45:01 +0100 Subject: [PATCH] Allow to `Overwrite` keyboard and mouse button state --- SteamController/Devices/KeyboardController.cs | 8 ++++++++ SteamController/Devices/MouseController.cs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/SteamController/Devices/KeyboardController.cs b/SteamController/Devices/KeyboardController.cs index 46d8759..13baeb5 100644 --- a/SteamController/Devices/KeyboardController.cs +++ b/SteamController/Devices/KeyboardController.cs @@ -114,6 +114,14 @@ namespace SteamController.Devices } } + public void Overwrite(VirtualKeyCode key, bool value) + { + if (value) + this[key] = true; + else + keyCodes.Remove(key); + } + public void KeyPress(params VirtualKeyCode[] keyCodes) { Safe(() => simulator.Keyboard.KeyPress(keyCodes)); diff --git a/SteamController/Devices/MouseController.cs b/SteamController/Devices/MouseController.cs index ed08a05..34a593e 100644 --- a/SteamController/Devices/MouseController.cs +++ b/SteamController/Devices/MouseController.cs @@ -239,6 +239,14 @@ namespace SteamController.Devices } } + public void Overwrite(Button button, bool value) + { + if (value) + mouseButtons.Add(button); + else + mouseButtons.Remove(button); + } + public void MoveBy(double pixelDeltaX, double pixelDeltaY) { movedX.Add(pixelDeltaX);