1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-13 09:08:34 +00:00

Updated Understanding CUE.NET ledgroups (markdown)

DarthAffe 2017-01-08 11:07:32 +01:00
parent f022cb1cdd
commit 952002a627

@ -1,30 +1,28 @@
> This feature exists for keyboards only. If you only want to control a mouse or headset feel free to skip this section. Ledgroups are one of the basic features of CUE.NET.
They are used to group multiple LEDs together and apply [brushes](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-brushes) and [effects](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-effects) to them.
Keygroups are one of the basic features of CUE.NET. By the default every device itself acts as a ledgroup containing all it's LEDs. Since the device-ledgroup is always handled first on updates it's especially useful to add a background.
They are used to group multiple keys together and apply [brushes](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-brushes) and [effects](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-effects) to them.
By the default always one keygroup exists. The _CorsairKeyboard_-class represents a keygroup containing all keys of the keyboard. Since the keyboard-keygroup is always handled first on updates it's especially useful to add a background. Every ledgroup implements the _ILedGroup_-interface:
Every keygroup implements the _IKeyGroup_-interface:
```C# ```C#
public interface IKeyGroup public interface ILedGroup : IEffectTarget<ILedGroup>
{ {
IEnumerable<CorsairKey> Keys { get; }
IBrush Brush { get; set; } IBrush Brush { get; set; }
int ZIndex { get; set; } int ZIndex { get; set; }
IEnumerable<CorsairLed> GetLeds(); IEnumerable<CorsairLed> GetLeds();
} }
``` ```
The _Keys_-property provides a list of all contained keys. The respective LEDs are returned by the _GetLeds_-method. You are also able to set the [brush](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-brushes) of the group through the _Brush_-property. To specify in which order groups are handled on updates, you can use the _ZIndex_-property. It defaults to 0, lower values will be handled first. The LEDs the group is containing are returned by the _GetLeds_-method. You are also able to set the [brush](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-brushes) of the group through the _Brush_-property. To specify in which order groups are handled on updates, you can use the _ZIndex_-property. It defaults to 0, lower values will be handled first.
In addition to that, a ledgroup is always qualified to be targeted by [effects](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-effects) since it's marked with the _IEffectTarget_-interface.
> If you plan to implement your own keygroup you should derive the _BaseKeyGroup_-class. Everything except the calculation of contained keys will be handled there. > If you plan to implement your own ledgroup you should derive the _AbstractLedGroup_-class. Everything (including everything effect related) except the calculation of contained LEDs will be handled there.
CUE.NET currently provides two keygroups to work with: CUE.NET currently provides two ledgroups to work with:
#### ListKeyGroup #### ListLedGroup
The _ListKeyGroup_ is designed to contain arbitrary keys. You can add or remove keys and check if a key is contained by using the respective methods _AddKey_, _RemoveKey_ and _ContainsKey_. The _ListLedGroup_ is designed to contain arbitrary LEDs. You can add or remove LEDs and check if a LED is contained by using the respective methods _AddLed_, _RemoveLed_ and _ContainsLed_.
You can also merge any other keygroup by calling the _MergeKeys_-method You can also merge any other ledgroups by calling the _MergeLeds_-method
#### RectangleKeyGroup #### RectangleLedGroup
This keygroup calculates the contained keys by laying the specified rectangle over the keyboard and include every key which intersects with a higher percentage than specified in the _MinOverlayPercentage_-property [0.5 by default]. This ledgroup calculates the contained LEDs by laying the specified rectangle over the device (this is only useful for keyboards) and include every LED which intersects with a higher percentage than specified in the _MinOverlayPercentage_-property [0.5 by default].
If there are keys inside this rectangle you don't want to include, you can call the _exclude_-extension method afterwards which returns the respective _ListKeyGroup_. If there are LEDs inside this rectangle you don't want to include, you can call the _exclude_-extension method afterwards which returns the respective _ListLedGroup_.