From 9afa0ee2902af5535e6342a58cd1400c68f6031a Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sat, 14 Nov 2015 11:31:07 +0100 Subject: [PATCH] Added some more content --- ...nding-CUE.NET-keygroups-(keyboard-only).md | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Understanding-CUE.NET-keygroups-(keyboard-only).md b/Understanding-CUE.NET-keygroups-(keyboard-only).md index 75473dc..813fe9b 100644 --- a/Understanding-CUE.NET-keygroups-(keyboard-only).md +++ b/Understanding-CUE.NET-keygroups-(keyboard-only).md @@ -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 Keys { get; } + IBrush Brush { get; set; } + int ZIndex { get; set; } + IEnumerable 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_. \ No newline at end of file