-
Notifications
You must be signed in to change notification settings - Fork 18
Perform basic lighting
The most basic form of using CUE.NET is by individually setting the color of every LED and manually triggering an update.
Even if this seems easy to use it's not recommended. You should take a look at groups and brushes instead!
Especially on keyboards you might run into a lot of trouble mixing direct lighting and brushes! Just take the time and check out how it works.You can do everything with brushes that's possible with direct lightning and in most cases it will safe you a whole lot of work.
It's not that difficult or take that much extra work as you might think now!
Direct lighting of a key can be achieved by getting the LED you want to color through one of the indexers from the SDK. (The one connected to the device you want to control.)
This code would set the color of the A-key on your keyboard to red and the color of the B-key to green. After that it would set the B1-LED (location depends on the device) to blue.
All other keys would keep the color they had before:
CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
keyboard.Brush = (SolidColorBrush)Color.Transparent; // This 'enables' manual color changes.
keyboard['A'].Color = Color.Red;
keyboard[CorsairKeyboardKeyId.B].Color = Color.Green;
keyboard.Update();
CorsairMouse mouse = CueSDK.MouseSDK;
mouse[CorsairMouseLedId.B1].Color = Color.Blue;
mouse.Update();
By default you need to call device.Update() every time you want your changes be written to the device. Since this is quite unhandy in some situations you can activate automatic updates:
CueSDK.UpdateMode = UpdateMode.Continuous;
This would instruct the keyboard to apply changes 30 times a second (every 33.3 millisecond) [default value].
Of course you can change the update rate to better fit your needs. The value is set in seconds. You can calculate it quite easy by dividing 1 by the amount of updates per second you need (make sure it's calculated as a floating point number!). The following example would set the update-rate to 60 times a second:
CueSDK.UpdateFrequency = 1f/60f;
Be aware of the performance impact of high update-rates!
Since the update rate is limited by CUE and the hardware, you'll most likely not see any improvements by using more then 40 updates per second.
Inside of CUE.NET colors are represented as a own class called CorsairColor.
This allows colors to be reference and processed in an advanced way. To keep things simple when working with CUE.NET any CorsairColor is implicit convertible to and from System.Drawing.Color.
CorsairColors are unlike System.Draw.Colors reference-types. Keep that in mind when modifying a color that might be used multiple times!
You can copy any color by simply creating a new one and pass the old as a parameter to the constructor.
Please drop me a message if you find mistakes or inadequate descriptions in one of the pages here!
-
Introduction
1.1. What is CUE.NET?
1.2. What can I do with CUE.NET?
1.3. Projects using CUE.NET -
Getting started
2.1. Adding CUE.NET to a project
2.2. Initializing CUE.NET
2.3. Perform basic lighting
2.4. Understanding CUE.NET ledgroups -
Gradients
3.1. Understanding CUE.NET gradients
3.2. Linear Gradient
3.3. Rainbow Gradient
3.4. Implementing an own gradient -
Brushes
4.1. Understanding CUE.NET brushes
4.2. Color-Corrections
4.3. Solid-Color Brush
4.4. Linear-Gradient Brush
4.5. Radial-Gradient Brush
4.6. Random-Color Brush
4.7. Image-Brush
4.8. Implementing an own brush -
Effects
5.1. Understanding CUE.NET effects
5.2. Flash Effect
5.3. Move-Gradient Effect
5.4. Implementing an own effect -
Tutorials