OpenRGB.NET icon indicating copy to clipboard operation
OpenRGB.NET copied to clipboard

Documentation

Open Tom60chat opened this issue 5 years ago • 5 comments

It's difficult to use this library without documentation.

Can you made one ?

Tom60chat avatar Jul 23 '20 18:07 Tom60chat

Just examples would be a beginning. Multiple examples.

BalaDeSilver avatar Dec 01 '20 03:12 BalaDeSilver

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);
	}
}

Tom60chat avatar Dec 01 '20 08:12 Tom60chat

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.

gyorokpeter avatar Mar 30 '21 21:03 gyorokpeter

I'm not sure what you mean by this. If i understood correctly, there are in general two ways of identifying LEDs:

  • by their name. Some of these names are standardized. I use a list in my RGB.NET provider here
  • Using the matrix map. if a zone is of type 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 here

Hope that helps.

diogotr7 avatar Mar 31 '21 00:03 diogotr7

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.

gyorokpeter avatar Mar 31 '21 08:03 gyorokpeter