Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Understanding CUE.NET ledgroups

DarthAffe edited this page Jan 8, 2017 · 2 revisions

Ledgroups are one of the basic features of CUE.NET.
They are used to group multiple LEDs together and apply brushes and effects to them.

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.

Every ledgroup implements the ILedGroup-interface:

public interface ILedGroup : IEffectTarget<ILedGroup>
{
    IBrush Brush { get; set; }
    int ZIndex { get; set; }
    IEnumerable<CorsairLed> GetLeds();
}

The LEDs the group is containing are returned by the GetLeds-method. You are also able to set the brush 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 since it's marked with the IEffectTarget-interface.

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 ledgroups to work with:

ListLedGroup

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 ledgroups by calling the MergeLeds-method

RectangleLedGroup

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 LEDs inside this rectangle you don't want to include, you can call the exclude-extension method afterwards which returns the respective ListLedGroup.

Clone this wiki locally