diff --git a/Perform-basic-lighting.md b/Perform-basic-lighting.md index 30404ce..ece3426 100644 --- a/Perform-basic-lighting.md +++ b/Perform-basic-lighting.md @@ -1 +1,36 @@ -TODO \ No newline at end of file +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._ + +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: +```C# +CorsairKeyboard keyboard = CueSDK.KeyboardSDK; +keyboard['A'].Led.Color = Color.Red; +keyboard[CorsairKeyboardKeyId.B].Led.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: +```C# +CorsairKeyboard keyboard = CueSDK.KeyboardSDK; +keyboard.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: +```C# +CorsairKeyboard keyboard = CueSDK.KeyboardSDK; +keyboard.UpdateFrequency = 1f/60f; +```