1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 16:58:29 +00:00

Added key-access through chars

This commit is contained in:
unknown 2015-09-20 10:36:48 +02:00
parent 5d96a1ba11
commit 61b712d026
5 changed files with 15 additions and 2 deletions

View File

@ -5,6 +5,7 @@ namespace CUE.NET.Devices.Headset.Enums
{
public enum CorsairHeadsetLedId
{
Invalid = 0,
LeftLogo = 152,
RightLogo = 153
}

View File

@ -32,6 +32,12 @@ namespace CUE.NET.Devices.Keyboard
private set { throw new NotSupportedException(); }
}
public CorsairKey this[char key]
{
get { return this[_CUESDK.CorsairGetLedIdForKeyName(key)]; }
private set { throw new NotSupportedException(); }
}
public CorsairKey this[PointF location]
{
get { return _keys.Values.FirstOrDefault(x => x.KeyRectangle.Contains(location)); }

View File

@ -5,6 +5,7 @@ namespace CUE.NET.Devices.Keyboard.Enums
{
public enum CorsairKeyboardKeyId
{
Invalid = 0,
Escape = 1,
F1 = 2,
F2 = 3,

View File

@ -5,6 +5,7 @@ namespace CUE.NET.Devices.Mouse.Enums
{
public enum CorsairMouseLedId
{
Invalid = 0,
B1 = 148,
B2 = 149,
B3 = 150,

View File

@ -39,9 +39,10 @@ namespace SimpleDevTest
centerGroup.SetColor(Color.Purple);
// Ink the Keys 'r', 'g', 'b' in their respective color
keyboard[CorsairKeyboardKeyId.R].Led.Color = Color.Red;
// The char access seems to fail for everything except letters (SDK doesn't return a valid keyId)
keyboard['R'].Led.Color = Color.Red;
keyboard[CorsairKeyboardKeyId.G].Led.Color = Color.Green;
keyboard[CorsairKeyboardKeyId.B].Led.Color = Color.Blue;
keyboard['B'].Led.Color = Color.Blue;
// Ink the letters of 'white' white
SimpleKeyGroup whiteGroup = new SimpleKeyGroup(keyboard, CorsairKeyboardKeyId.W, CorsairKeyboardKeyId.H, CorsairKeyboardKeyId.I, CorsairKeyboardKeyId.T, CorsairKeyboardKeyId.E);
@ -122,6 +123,9 @@ namespace SimpleDevTest
{
Console.WriteLine("Exception! Message:" + ex.Message);
}
while (true)
Thread.Sleep(1000); // Don't exit after exception
}
private static PointF Interpolate(PointF p1, PointF p2, float length)