Open Tom60chat opened 4 years ago
Just examples would be a beginning. Multiple examples.
If you want examples :
private OpenRGBClient client;
private bool Available => client != null ? client.Connected : false;
public bool Start(string name)
{
client = new OpenRGBClient(name: name, autoconnect: false);
try
{
client.Connect();
} catch (TimeoutException)
{
return false;
}
return Available;
}
public void SetLeds(DeviceType type, OpenRGB.NET.Models.Color color)
{
if (!Available) return;
OpenRGB.NET.Models.Color[] openRGBColors;
foreach (var deviceId in client.GetControllerCount())
{
device = client.GetControllerData(deviceId);
openRGBColors = new OpenRGB.NET.Models.Color[device.Colors.Length];
for (int i = 0; i < openRGBColors.Length; i++)
openRGBColors[i] = color;
client.UpdateLeds(deviceId, openRGBColors);
}
}
Is there a way to know which index in the array maps to which key? By adding a pause after changing the color of each key I found that it changes the keys roughly in columns, and roughly from left to right but not strictly in that order, with the function, cursor etc. keys randomly thrown in between.
I'm not sure what you mean by this. If i understood correctly, there are in general two ways of identifying LEDs:
Matrix
, you can use this to figure out the rough positions of the keys. each value in a matrix map corresponds to an index in the Colors array. I also use this for my RGB.NET provider to set the rough positions of LEDs hereHope that helps.
openRgbClient.UpdateLeds takes an array of colors. But there is nothing to indicate which element of the array corresponds to which key. For example for my keyboard, index 0 does nothing, index 1 is the ~/` key, index 2 is TAB... so I would like something that maps e.g. TILDE to 1, TAB to 2 etc.
It's difficult to use this library without documentation.
Can you made one ?