Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #5

Open
Tom60chat opened this issue Jul 23, 2020 · 5 comments
Open

Documentation #5

Tom60chat opened this issue Jul 23, 2020 · 5 comments

Comments

@Tom60chat
Copy link

Tom60chat commented Jul 23, 2020

It's difficult to use this library without documentation.

Can you made one ?

@BalaDeSilver
Copy link

Just examples would be a beginning. Multiple examples.

@Tom60chat
Copy link
Author

Tom60chat commented Dec 1, 2020

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

@gyorokpeter
Copy link

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.

@diogotr7
Copy link
Owner

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.

@gyorokpeter
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants