mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
OpenRgb - added segments
This commit is contained in:
1 parent
4675349621
commit
1793d26166
8 files changed
+118
-44
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using OpenRGB.NET.Enums;
|
||||
using OpenRGB.NET;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.OpenRGB;
|
||||
@@ -34,15 +34,15 @@ public class OpenRGBGenericDevice : AbstractOpenRGBDevice<OpenRGBDeviceInfo>
|
||||
int zoneLedIndex = 0;
|
||||
const int LED_SPACING = 20;
|
||||
|
||||
foreach (global::OpenRGB.NET.Models.Zone? zone in DeviceInfo.OpenRGBDevice.Zones)
|
||||
foreach (Zone? zone in DeviceInfo.OpenRGBDevice.Zones)
|
||||
{
|
||||
if (zone.Type == ZoneType.Matrix)
|
||||
{
|
||||
for (int row = 0; row < zone.MatrixMap.Height; row++)
|
||||
for (int row = 0; row < zone.MatrixMap!.Height; row++)
|
||||
{
|
||||
for (int column = 0; column < zone.MatrixMap.Width; column++)
|
||||
for (int column = 0; column < zone.MatrixMap!.Width; column++)
|
||||
{
|
||||
uint index = zone.MatrixMap.Matrix[row, column];
|
||||
uint index = zone.MatrixMap!.Matrix[row, column];
|
||||
|
||||
//will be max value if the position does not have an associated key
|
||||
if (index == uint.MaxValue)
|
||||
@@ -59,7 +59,7 @@ public class OpenRGBGenericDevice : AbstractOpenRGBDevice<OpenRGBDeviceInfo>
|
||||
ledId = initial++;
|
||||
}
|
||||
}
|
||||
y += (int)(zone.MatrixMap.Height * LED_SPACING);
|
||||
y += (int)(zone.MatrixMap!.Height * LED_SPACING);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
using RGB.NET.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRGBColor = OpenRGB.NET.Models.Color;
|
||||
using OpenRGBDevice = OpenRGB.NET.Models.Device;
|
||||
using Color = RGB.NET.Core.Color;
|
||||
using OpenRGBColor = OpenRGB.NET.Color;
|
||||
using OpenRGBDevice = OpenRGB.NET.Device;
|
||||
|
||||
namespace RGB.NET.Devices.OpenRGB;
|
||||
|
||||
@@ -15,10 +16,9 @@ public class OpenRGBUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly int _deviceid;
|
||||
private readonly int _deviceId;
|
||||
|
||||
private readonly OpenRGBClient _openRGB;
|
||||
private readonly OpenRGBDevice _device;
|
||||
private readonly OpenRgbClient _openRGB;
|
||||
private readonly OpenRGBColor[] _colors;
|
||||
|
||||
#endregion
|
||||
@@ -29,17 +29,16 @@ public class OpenRGBUpdateQueue : UpdateQueue
|
||||
/// Initializes a new instance of the <see cref="OpenRGBUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceid">The index used to identify the device.</param>
|
||||
/// <param name="deviceId">The index used to identify the device.</param>
|
||||
/// <param name="client">The OpenRGB client used to send updates to the OpenRGB server.</param>
|
||||
/// <param name="device">The OpenRGB Device containing device-specific information.</param>
|
||||
public OpenRGBUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceid, OpenRGBClient client, OpenRGBDevice device)
|
||||
public OpenRGBUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceId, OpenRgbClient client, OpenRGBDevice device)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
this._deviceid = deviceid;
|
||||
this._deviceId = deviceId;
|
||||
this._openRGB = client;
|
||||
this._device = device;
|
||||
|
||||
_colors = Enumerable.Range(0, _device.Colors.Length)
|
||||
_colors = Enumerable.Range(0, device.Colors.Length)
|
||||
.Select(_ => new OpenRGBColor())
|
||||
.ToArray();
|
||||
}
|
||||
@@ -56,7 +55,7 @@ public class OpenRGBUpdateQueue : UpdateQueue
|
||||
foreach ((object key, Color color) in dataSet)
|
||||
_colors[(int)key] = new OpenRGBColor(color.GetR(), color.GetG(), color.GetB());
|
||||
|
||||
_openRGB.UpdateLeds(_deviceid, _colors);
|
||||
_openRGB.UpdateLeds(_deviceId, _colors);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user