Device dialog - Added input remapping for keyboards

Device dialog - Display layout author, if I missed anyone let me know!
This commit is contained in:
Robert committed 2021-04-10 12:53:08 +02:00
1 parent 8066586328
commit c66c21152f
12 files changed
+302 -38

No files matched your search

@@ -3,9 +3,15 @@ using RGB.NET.Core;
namespace Artemis.Core.Services
{
internal static class InputKeyUtilities
/// <summary>
/// Utilities for mapping keys and buttons to LEDs
/// </summary>
public static class InputKeyUtilities
{
internal static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new()
/// <summary>
/// A dictionary of mappings between <see cref="KeyboardKey" /> and <see cref="LedId" />
/// </summary>
public static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new()
{
{KeyboardKey.None, LedId.Keyboard_Custom1},
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
@@ -182,7 +188,10 @@ namespace Artemis.Core.Services
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
};
internal static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new()
/// <summary>
/// A dictionary of mappings between <see cref="MouseButton" /> and <see cref="LedId" />
/// </summary>
public static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new()
{
{MouseButton.Left, LedId.Mouse1},
{MouseButton.Middle, LedId.Mouse2},
@@ -201,7 +201,7 @@ namespace Artemis.Core.Services
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
ArtemisLed? led = null;
if (foundLedId && e.Device != null)
led = e.Device.GetLed(ledId);
led = e.Device.GetLed(ledId, true);
// Create the UpDown event args because it can be used for every event
ArtemisKeyboardKeyUpDownEventArgs eventArgs = new(e.Device, led, e.Key, keyboardModifierKey, e.IsDown);