Darth Affe Posted September 18, 2015 Share Posted September 18, 2015 Current version: 1.2.0 You'll always find the latest release on nuget https://www.nuget.org/packages/CUE.NET/ or (sometimes older) releases at https://github.com/DarthAffe/CUE.NET/releases/latest and the source at https://github.com/DarthAffe/CUE.NET This is considered done now and will be no longer actively developed (only bugfixes if needed). CUE.NET will be superseded by RGB.NET. Feel free to join the discord-channel if you're interested what's happening there :) Features: Full Control over the LEDs of your SDK-supported Corsair-Devices through a C#-API Reading, saving and restoring colors on the keyboard By-key-access to every supported led or grouping in regions/lists Comprehensive render-engine based on brushes to allow easy drawing over multiple leds. Effect-engine to animate brushes or groups of leds Capture special key-pressed (including G- (keyboard) and M- (mouse) keys) Link to comment Share on other sites More sharing options...
goomonster3 Posted September 19, 2015 Share Posted September 19, 2015 Hey man, good work! I too much prefer c# over c++, could you give us some example code that we could test and work with :)? Thanks Link to comment Share on other sites More sharing options...
Darth Affe Posted September 19, 2015 Author Share Posted September 19, 2015 Hey goomonster3, I just committed a small example of what's possible for now. This is rudimentary, but I'm going to bring it into some structure now. Link to comment Share on other sites More sharing options...
goomonster3 Posted September 19, 2015 Share Posted September 19, 2015 Hey goomonster3, I just committed a small example of what's possible for now. This is rudimentary, but I'm going to bring it into some structure now. Sweet! Thank you a lot - I am gonna try and do some stuff with your "ported" c# sdk now :D. Keep up the good work - loads of developers will appreciate it later when this gets noticed! Link to comment Share on other sites More sharing options...
goomonster3 Posted September 19, 2015 Share Posted September 19, 2015 Update: Can't get your example to start - 14 errors Here they are: https://gyazo.com/53efc7509528454c2aa9c33f8fe84037 Link to comment Share on other sites More sharing options...
Darth Affe Posted September 19, 2015 Author Share Posted September 19, 2015 Are you using Visual Studio 2015? I've used C# 6 language features which (as far as I know) can't be built with older versions. Link to comment Share on other sites More sharing options...
goomonster3 Posted September 19, 2015 Share Posted September 19, 2015 Are you using Visual Studio 2015? I've used C# 6 language features which (as far as I know) can't be built with older versions. Ahh I am using 2013 i believe, ill try 2015. Link to comment Share on other sites More sharing options...
goomonster3 Posted September 19, 2015 Share Posted September 19, 2015 Working! :) Thanks! Link to comment Share on other sites More sharing options...
Darth Affe Posted September 20, 2015 Author Share Posted September 20, 2015 I've just created an release tag for a version which seems to work quite well. As said until now it's nothing too fancy but for anyone who wants to utilize the api it should be a good place to start. Link: https://github.com/DarthAffe/CUE.NET/releases/tag/v0.1.0 Like before I appreciate ideas of what to add, help with other devices than my K95 (the only device it's tested until now) or someone who checks my spelling and grammar to let the documentation (well, or code-comments) be understandable :p Link to comment Share on other sites More sharing options...
solhuebner Posted September 28, 2015 Share Posted September 28, 2015 What would be great if you could light up the keyboard if you click a mouse button :-) But I am still waiting for my M65 RGB as it was hard to find one with the sails logo. The gaming logo looks %*@# ;-) Link to comment Share on other sites More sharing options...
e-rap Posted October 7, 2015 Share Posted October 7, 2015 Hey Darth, I was fooling around with you're wrapper and got this cool lighting effect by modifying your sample program.Lightning.zip Link to comment Share on other sites More sharing options...
Darth Affe Posted October 7, 2015 Author Share Posted October 7, 2015 Hey Darth, I was fooling around with you're wrapper and got this cool lighting effect by modifying your sample program. Nice one! I'm about to finish all the stuff to release a stable version 1.0 - I hope you'll use it to do more cool things :) Link to comment Share on other sites More sharing options...
Elestriel Posted October 15, 2015 Share Posted October 15, 2015 Hey! I'd like to know how far along you might be on the development of support for mice and headsets! If you're still working on it, I could pitch in. I'm using your wrapper in my program, now, and I'd love to extend my effects to all the devices through SDK. Let me know here or in a PM if you'd like to work together on what's left, please! :) Link to comment Share on other sites More sharing options...
Barnacules Posted December 5, 2015 Share Posted December 5, 2015 I'm noticing that the SDK detects my keyboard but the keys collection contains zero elements. I have a Corsair K95 under Windows 10 with latest CUE Engine, driver and firmware. using Version 0.2.0.0 of CUE.NET and tries .NET 4.5 and 4.6. -- CODE -- CueSDK.Initialize(); Console.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK"); CorsairKeyboard keyboard = CueSDK.KeyboardSDK; Console.WriteLine(keyboard.DeviceInfo.Model); Console.WriteLine(keyboard.DeviceInfo.Type.ToString()); Console.WriteLine(keyboard.DeviceInfo.CapsMask.ToString()); if (keyboard == null) throw new Exception("Keyboard not found"); keyboard['A'].Led.Color = Color.Red; keyboard[CorsairKeyboardKeyId.B].Led.Color = Color.Green; keyboard.Update(); End's with an uninitialized object exception when I try to touch keyboard['A'] and if I output the contents of the keys collection I have a count of zero. It does however report the K95 keyboard properly after I initialize. Help? I'm trying to write a program to do something really cool with the LED's and serve it as a #Codegasm episode on http://barnnerd.com Link to comment Share on other sites More sharing options...
Darth Affe Posted December 5, 2015 Author Share Posted December 5, 2015 Hmm, sounds a bit weird - I'll investigate this. Could you try to run the color_pulse-example provided by corsair with the sdk? This would help to make sure that there is no general problem with your CUE-, OS-, firmware-, device-combination. Link to comment Share on other sites More sharing options...
Darth Affe Posted December 23, 2015 Author Share Posted December 23, 2015 I finally finished a V1.0. Check the updates start-post (http://forum.corsair.com/v3/showpost.php?p=807549&postcount=1) or https://github.com/DarthAffe/CUE.NET/releases/tag/v1.0 Link to comment Share on other sites More sharing options...
Darth Affe Posted February 7, 2016 Author Share Posted February 7, 2016 I finished V1.0.1 with some basic CUE profile support (only colors so far) https://github.com/DarthAffe/CUE.NET/releases/tag/v1.0.1 Link to comment Share on other sites More sharing options...
dabates Posted February 18, 2016 Share Posted February 18, 2016 Quick stupid question.. I'm writting an alert program that's going to run in the background.. I got everything working .. except this.. Basically what I do is flash lights (Brush color, Brush black.. etc) .. then at the end of that "flash" function I'd like the keyboard to revert back to the profile that's running before the flashing begain (like it does when you close the program) .. I am not opening it exclusive.. and I know the problem is that it's ujsing a black brush. I've tried to use a transparent brush to see if that would work.. but no dice.. is there a way ( or do you know of a way ) that will release control of the keyboard back to CUE so the profile will continue to run as it did before, or a way to just "reset" the keyboard? Link to comment Share on other sites More sharing options...
Darth Affe Posted February 19, 2016 Author Share Posted February 19, 2016 No, at the moment there is no way to get any kind of information about CUE through the SDK. That's why currently (as far as I know) there are only two ways to release control of the keyboard back to CUE (and it seems that you know of both): 1. Close the application (this is quite obvious^^) 2. Run your application in shared access mode (this is default). CUE should regain access as soon as it updates something. (That's why a CUE-profile containing only background lights will never get control back.) The profile loading option I introduced with the last update allows some kind of workaround to this problem, but you need to know to which profile you'd like to revert to (the default-profile is the only 'variable' thing, since it's possible to get this out of the CUE-config file). EDIT: Just as I wrote this I came up with something that might work: Actually it should be possible to reset the connection to the SDK (to reset the keyboard to CUE settings) without losing internal states. I'll investigate this over the weekend - sometimes things are too easy to be recognized^^ Link to comment Share on other sites More sharing options...
Darth Affe Posted February 20, 2016 Author Share Posted February 20, 2016 I just added the possibility to reinitialize - this should solve your problem. https://github.com/DarthAffe/CUE.NET/releases/tag/v1.0.2 Just update to the latest version (nuget-packages are updated too). Link to comment Share on other sites More sharing options...
dabates Posted March 16, 2016 Share Posted March 16, 2016 I just added the possibility to reinitialize - this should solve your problem. https://github.com/DarthAffe/CUE.NET/releases/tag/v1.0.2 Just update to the latest version (nuget-packages are updated too). Sorry for the late response, I didn't get notified of a change.. .. I will need to fix that.. I will pull down the pre-release nuget and see if it works :) thanks for your help! UPDATE: This works perfectly.. :) I'm using it for a monitoring program that flashes the keyboard when I have PRTG issues.. and this worked great! I appreciate it! Link to comment Share on other sites More sharing options...
Darth Affe Posted June 4, 2016 Author Share Posted June 4, 2016 I just published a new version (1.0.3) which contains quite a lot new stuff. https://github.com/DarthAffe/CUE.NET/releases/tag/v1.0.3 Nuget-packages are of course up2date. Link to comment Share on other sites More sharing options...
Darth Affe Posted September 11, 2016 Author Share Posted September 11, 2016 I just published a big release (1.1.0) [hotfixed to 1.1.0.1] https://github.com/DarthAffe/CUE.NET/releases/tag/1.1.0.1 Nuget-packages are of course up2date. Link to comment Share on other sites More sharing options...
goomonster3 Posted December 20, 2016 Share Posted December 20, 2016 Hey, Any chance you could give me a simple example of a rainbow wave flowing from left to right on the keyboard. I looked at your WIKI on git but I can't figure out how to make it flow, only static is working. Thanks! Link to comment Share on other sites More sharing options...
Darth Affe Posted December 20, 2016 Author Share Posted December 20, 2016 Hey, the wiki is currently really outdated - sorry for that but I'm just to lazy to work on it ... I created a short example (consisting of two files) - whole project is attached too: Program.cs using System; using System.Drawing; using System.Threading; using System.Threading.Tasks; using CUE.NET; using CUE.NET.Brushes; using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Keyboard; using CUE.NET.Exceptions; using CUE.NET.Gradients; using CUE.NET.Groups; namespace FlowingRainbow { class Program { static void Main(string[] args) { try { CueSDK.Initialize(); CorsairKeyboard keyboard = CueSDK.KeyboardSDK; if (keyboard == null) { Console.WriteLine("Can't initialize keyboard ..."); Console.ReadKey(); return; } // I prefer to always add a solid black background to prevent "bleeding" colors if transparency is used. keyboard.Brush = (SolidColorBrush)Color.Black; // Create a ledGroup containing all the leds you want to brush (in this case the whole keyboard). ILedGroup rainbowLedGroup = new ListLedGroup(keyboard, keyboard); // Prepare to brushes (we want to toggle them) and add one to the group. LinearGradientBrush linearRainbowBrush = new LinearGradientBrush(new RainbowGradient()); RadialGradientBrush radialRainbowBrush = new RadialGradientBrush(new RainbowGradient()); rainbowLedGroup.Brush = linearRainbowBrush; // Add our custom effect to the brush to animate the rainbow. MovingRainbowEffect movingRainbowEffect = new MovingRainbowEffect(); rainbowLedGroup.Brush.AddEffect(movingRainbowEffect); // Enable automatic updates to allow the effect to work (you might want to tune 'CueSDK.UpdateFrequency' too) CueSDK.UpdateMode = UpdateMode.Continuous; // We want a really fancy console-application :p Console.WriteLine("Change speed with 'w' and 's'"); Console.WriteLine("Change direction with 'd'"); Console.WriteLine("Change brush with 'b'"); Console.WriteLine("Press ESC to exit ..."); Console.WriteLine(); Task.Factory.StartNew( () => { ConsoleKey key; do { key = Console.ReadKey().Key; switch (key) { case ConsoleKey.W: movingRainbowEffect.Speed += 10f; Console.WriteLine($"\rIncreasing speed to {movingRainbowEffect.Speed}"); break; case ConsoleKey.S: movingRainbowEffect.Speed -= 10f; Console.WriteLine($"\rDecreasing speed to {movingRainbowEffect.Speed}"); break; case ConsoleKey.D: movingRainbowEffect.Direction = !movingRainbowEffect.Direction; Console.WriteLine($"\rChanging direction to {movingRainbowEffect.Direction}"); break; case ConsoleKey.B: // We want to reuse our effect for both brushes so we need to set it free first rainbowLedGroup.Brush.RemoveEffect(movingRainbowEffect); // Swap the brush (this isn't good code, but this is an example :p rainbowLedGroup.Brush = (rainbowLedGroup.Brush is LinearGradientBrush) ? (IBrush)radialRainbowBrush : linearRainbowBrush; // Apply the effect the the other brush rainbowLedGroup.Brush.AddEffect(movingRainbowEffect); Console.WriteLine($"\rChanging brush to {rainbowLedGroup.Brush.GetType()}"); break; } } while (key != ConsoleKey.Escape); Environment.Exit(0); }); } catch (CUEException ex) { Console.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error)); } catch (WrapperException ex) { Console.WriteLine("Wrapper Exception! Message:" + ex.Message); } catch (Exception ex) { Console.WriteLine("Exception! Message:" + ex.Message); } while (true) Thread.Sleep(1000); // Don't exit after exception } } } MovingRainbowEffect.cs using CUE.NET.Brushes; using CUE.NET.Effects; using CUE.NET.Gradients; namespace FlowingRainbow { public class MovingRainbowEffect : AbstractBrushEffect<IGradientBrush> { #region Properties & Fields public bool Direction { get; set; } public float Speed { get; set; } // 30 degree per second (see https://upload.wikimedia.org/wikipedia/commons/a/ad/HueScale.svg) #endregion #region Constructors public MovingRainbowEffect(float speed = 180f, bool direction = true) { this.Speed = speed; this.Direction = direction; } #endregion #region Methods public override void Update(float deltaTime) { // Our effect only works with rainbow-gradients RainbowGradient rainbowGradient = Brush.Gradient as RainbowGradient; if (rainbowGradient == null) return; // Calculate amount of movement we need to do considering the time since the last update, to be update-rate-independent. float movement = Speed * deltaTime; // Inverse our movement if we want move the rainbow in the other direction. if (!Direction) movement = -movement; // Move the whole gradient // Please notice, that this isn't good code since we're only increasing the value all the time. Like this we might get an overflow if the animation runs to long. // This should be prevented according to your specific use-case. rainbowGradient.StartHue += movement; rainbowGradient.EndHue += movement; } // Make sure that we only apply this effect if the brush has an rainbow gradient public override bool CanBeAppliedTo(IBrush target) { return (target as IGradientBrush)?.Gradient is RainbowGradient; } #endregion } } FlowingRainbow.zip Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.