1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 10:08:31 +00:00
RGB.NET/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs

40 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using RGB.NET.Core;
using RGB.NET.Devices.Razer.Native;
namespace RGB.NET.Devices.Razer
{
public class RazerMouseUpdateQueue : RazerUpdateQueue
{
#region Constructors
public RazerMouseUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
: base(updateTrigger, deviceId)
{ }
#endregion
#region Methods
/// <inheritdoc />
protected override IntPtr CreateEffectParams(Dictionary<object, Color> dataSet)
{
_Color[] colors = new _Color[_Defines.MOUSE_MAX_LEDS];
foreach (KeyValuePair<object, Color> data in dataSet)
colors[(int)data.Key] = new _Color(data.Value);
_MouseCustomEffect effectParams = new _MouseCustomEffect { Color = colors };
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(effectParams));
Marshal.StructureToPtr(effectParams, ptr, false);
return ptr;
}
#endregion
}
}