diff --git a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs
index b205126..30d332e 100644
--- a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs
+++ b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs
@@ -117,6 +117,11 @@ namespace RGB.NET.Devices.CoolerMaster
CoolerMasterPhysicalKeyboardLayout physicalLayout = _CoolerMasterSDK.GetDeviceLayout();
device = new CoolerMasterKeyboardRGBDevice(new CoolerMasterKeyboardRGBDeviceInfo(index, physicalLayout, GetCulture()));
break;
+
+ case RGBDeviceType.Mouse:
+ device = new CoolerMasterMouseRGBDevice(new CoolerMasterMouseRGBDeviceInfo(index));
+ break;
+
default:
if (throwExceptions)
throw new RGBDeviceException("Unknown Device-Type");
diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs
index 79ab16d..3a30cc2 100644
--- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs
+++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs
@@ -1,7 +1,5 @@
using System.Collections.Generic;
-using System.Linq;
using RGB.NET.Core;
-using RGB.NET.Devices.CoolerMaster.Native;
namespace RGB.NET.Devices.CoolerMaster
{
@@ -26,27 +24,6 @@ namespace RGB.NET.Devices.CoolerMaster
#region Methods
- ///
- protected override void UpdateLeds(IEnumerable ledsToUpdate)
- {
- List leds = ledsToUpdate.Where(x => x.Color.A > 0).ToList();
-
- if (leds.Count > 0)
- {
- // 6 by 22 seems hard-coded but it's what the CM SDK expects regardless of keyboard size
- _CoolerMasterColorMatrix colorMatrix = new _CoolerMasterColorMatrix { KeyColor = new _CoolerMasterKeyColor[_CoolerMasterColorMatrix.ROWS, _CoolerMasterColorMatrix.COLUMNS] };
- foreach (Led led in leds)
- {
- (int row, int column) = ((int, int))led.CustomData;
- colorMatrix.KeyColor[row, column] = new _CoolerMasterKeyColor(led.Color.R, led.Color.G, led.Color.B);
- }
-
- _CoolerMasterSDK.SetControlDevice(DeviceInfo.DeviceIndex);
- _CoolerMasterSDK.SetAllLedColor(colorMatrix);
- _CoolerMasterSDK.RefreshLed(false);
- }
- }
-
///
protected override void InitializeLayout()
{
diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseLedMappings.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseLedMappings.cs
index 1e00122..d2ce48b 100644
--- a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseLedMappings.cs
+++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseLedMappings.cs
@@ -20,18 +20,16 @@ namespace RGB.NET.Devices.CoolerMaster
{ CoolerMasterDevicesIndexes.MasterMouse_L, new Dictionary
{
{ LedId.Mouse1, (0,0) },
- { LedId.Mouse2, (1,0) },
- { LedId.Mouse3, (2,0) },
- { LedId.Mouse4, (3,0) },
+ { LedId.Mouse2, (0,1) },
+ { LedId.Mouse3, (0,2) },
+ { LedId.Mouse4, (0,3) }
}
},
{ CoolerMasterDevicesIndexes.MasterMouse_S, new Dictionary
{
{ LedId.Mouse1, (0,0) },
- { LedId.Mouse2, (1,0) },
- { LedId.Mouse3, (2,0) },
- { LedId.Mouse4, (3,0) },
+ { LedId.Mouse2, (0,1) }
}
},
};
diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs
new file mode 100644
index 0000000..3cbee5b
--- /dev/null
+++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs
@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.CoolerMaster
+{
+ ///
+ ///
+ /// Represents a CoolerMaster mouse.
+ ///
+ public class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice
+ {
+ #region Constructors
+
+ ///
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The specific information provided by CoolerMaster for the mouse
+ internal CoolerMasterMouseRGBDevice(CoolerMasterMouseRGBDeviceInfo info)
+ : base(info)
+ { }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ protected override void InitializeLayout()
+ {
+ Dictionary mapping = CoolerMasterMouseLedMappings.Mapping[DeviceInfo.DeviceIndex];
+
+ foreach (KeyValuePair led in mapping)
+ InitializeLed(led.Key, new Rectangle(led.Value.column * 19, led.Value.row * 19, 19, 19));
+
+ string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
+ ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\CoolerMaster\Mice\{model}.xml"), null);
+ }
+
+ ///
+ protected override object CreateLedCustomData(LedId ledId) => CoolerMasterMouseLedMappings.Mapping[DeviceInfo.DeviceIndex][ledId];
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs
new file mode 100644
index 0000000..6d78415
--- /dev/null
+++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs
@@ -0,0 +1,24 @@
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.CoolerMaster
+{
+ ///
+ ///
+ /// Represents a generic information for a .
+ ///
+ public class CoolerMasterMouseRGBDeviceInfo : CoolerMasterRGBDeviceInfo
+ {
+ #region Constructors
+
+ ///
+ ///
+ /// Internal constructor of managed .
+ ///
+ /// The index of the .
+ internal CoolerMasterMouseRGBDeviceInfo(CoolerMasterDevicesIndexes deviceIndex)
+ : base(RGBDeviceType.Mouse, deviceIndex)
+ { }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj
index 83b17ee..3f42fff 100644
--- a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj
+++ b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj
@@ -61,6 +61,8 @@
+
+