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

Added some more content

DarthAffe 2015-11-14 11:31:07 +01:00
parent a7ca6a0784
commit 9afa0ee290

@ -1,2 +1,30 @@
_This feature exists for keyboards only. If you only want to control a mouse or headset feel free to skip this section._ > This feature exists for keyboards only. If you only want to control a mouse or headset feel free to skip this section.
Keygroups are one of the basic features of CUE.NET.
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 keygroup implements the _IKeyGroup_-interface:
```C#
public interface IKeyGroup
{
IEnumerable<CorsairKey> Keys { get; }
IBrush Brush { get; set; }
int ZIndex { get; set; }
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.
> 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.
CUE.NET currently provides two keygroups to work with:
#### ListKeyGroup
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_.
You can also merge any other keygroup by calling the _MergeKeys_-method
#### RectangleKeyGroup
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].
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_.