mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-12 16:58:29 +00:00
Updated Perform basic lighting (markdown)
parent
f8708c7d38
commit
3bd9e13943
@ -1,37 +1,35 @@
|
||||
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](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-keygroups-%28keyboard-only%29) and [brushes](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-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. It's not that difficult or take that much extra work as you might think now!
|
||||
> **Even if this seems easy to use it's not recommended. You should take a look at [groups](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-keygroups-%28keyboard-only%29) and [brushes](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-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](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-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!
|
||||
|
||||
Since a keyboard consists of keys which contains a LED and mouse-/headset-devices only contains LEDs the usage differs slightly.
|
||||
|
||||
#### Keyboard ####
|
||||
This code would set the color of the A-key to red and the color of the B-key to green. All other keys would keep the color they had before:
|
||||
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:
|
||||
```C#
|
||||
CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
|
||||
keyboard['A'].Led.Color = Color.Red;
|
||||
keyboard[CorsairKeyboardKeyId.B].Led.Color = Color.Green;
|
||||
keyboard['A'].Color = Color.Red;
|
||||
keyboard[CorsairKeyboardKeyId.B].Color = Color.Green;
|
||||
keyboard.Update();
|
||||
```
|
||||
|
||||
#### Mouse/Headset ####
|
||||
This code would set the color of the B1-LED (location depends on the device) to blue. All other LEDs would keep the color they had before:
|
||||
```C#
|
||||
CorsairMouse mouse = CueSDK.MouseSDK;
|
||||
mouse[CorsairMouseLedId.B1].Color = Color.Blue;
|
||||
mouse.Update();
|
||||
```
|
||||
|
||||
### Manual/automatic 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 for each device by calling:
|
||||
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:
|
||||
```C#
|
||||
CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
|
||||
keyboard.UpdateMode = UpdateMode.Continuous;
|
||||
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. (Be aware of the performance impact of high update-rates!)
|
||||
The value is set in seconds. You can calculate it quite easy by dividing 1 by the amount of updates per second you need. The following example would set the update-rate to 60 times a second:
|
||||
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:
|
||||
```C#
|
||||
CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
|
||||
keyboard.UpdateFrequency = 1f/60f;
|
||||
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 on using more then 40 updates per second.
|
||||
Loading…
x
Reference in New Issue
Block a user