mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
adds MSI_MOUSE support
This commit is contained in:
parent
0b76199582
commit
04b78f7fd5
54
RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs
Normal file
54
RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Msi.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Msi
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a MSI mouse.
|
||||
/// </summary>
|
||||
public class MsiMouseRGBDevice : MsiRGBDevice<MsiRGBDeviceInfo>
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Msi.MsiMouseRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by MSI for the mouse.</param>
|
||||
internal MsiMouseRGBDevice(MsiRGBDeviceInfo info)
|
||||
: base(info)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeLayout(int ledCount)
|
||||
{
|
||||
for (int i = 0; i < ledCount; i++)
|
||||
{
|
||||
//Hex3l: Should it be configurable in order to provide style access?
|
||||
//Hex3l: Sets led style to "Steady" in order to have a solid color output therefore a controllable led color
|
||||
//Hex3l: This is a string defined by the output of _MsiSDK.GetLedStyle, "Steady" should be always present
|
||||
const string LED_STYLE = "Steady";
|
||||
|
||||
_MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, i, LED_STYLE);
|
||||
InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10));
|
||||
}
|
||||
|
||||
//TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
|
||||
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\MSI\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SyncBack()
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ namespace RGB.NET.Devices.Msi
|
||||
if (deviceType.Equals("MSI_MB"))
|
||||
{
|
||||
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
||||
IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceType, "Msi", "Motherboard"));
|
||||
IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceType, "MSI", "Motherboard"));
|
||||
motherboard.Initialize(updateQueue, ledCount);
|
||||
devices.Add(motherboard);
|
||||
}
|
||||
@ -128,10 +128,20 @@ namespace RGB.NET.Devices.Msi
|
||||
//Hex3l: The led name is the name of the card (e.g. NVIDIA GeForce RTX 2080 Ti) we could provide it in device info.
|
||||
|
||||
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
||||
IMsiRGBDevice graphicscard = new MsiGraphicsCardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.GraphicsCard, deviceType, "Msi", "GraphicsCard"));
|
||||
IMsiRGBDevice graphicscard = new MsiGraphicsCardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.GraphicsCard, deviceType, "MSI", "GraphicsCard"));
|
||||
graphicscard.Initialize(updateQueue, ledCount);
|
||||
devices.Add(graphicscard);
|
||||
}
|
||||
else if (deviceType.Equals("MSI_MOUSE"))
|
||||
{
|
||||
//Hex3l: Every led under MSI_MOUSE should be a different mouse. Handling all the mouses together seems a good way to avoid overlapping of leds
|
||||
//Hex3l: The led name is the name of the mouse (e.g. msi CLUTCH GM11) we could provide it in device info.
|
||||
|
||||
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
||||
IMsiRGBDevice mouses = new MsiMouseRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mouse, deviceType, "MSI", "Mouse"));
|
||||
mouses.Initialize(updateQueue, ledCount);
|
||||
devices.Add(mouses);
|
||||
}
|
||||
|
||||
//TODO DarthAffe 22.02.2020: Add other devices
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user