diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..d11c722 --- /dev/null +++ b/Program.cs @@ -0,0 +1,95 @@ +using System; +using System.Globalization; +using System.Threading; +using btwi.tiny_func; +using Illumilib; +// See https://aka.ms/new-console-template for more information + +int l = Environment.GetCommandLineArgs().Length; +if(l == 0) +{ + Environment.Exit(0); +} +string effect =Environment.GetCommandLineArgs()[1]; +int timeInS = int.Parse(Environment.GetCommandLineArgs()[2]); +float r = float.Parse(Environment.GetCommandLineArgs()[3],CultureInfo.InvariantCulture.NumberFormat); +float g = float.Parse(Environment.GetCommandLineArgs()[4], CultureInfo.InvariantCulture.NumberFormat); +float b = float.Parse(Environment.GetCommandLineArgs()[5], CultureInfo.InvariantCulture.NumberFormat); + +IllumilibLighting.Initialize(); + +switch (effect) +{ + case "blink": + Blink.blinking(timeInS, r,g,b); + break; + default: + + break; +} + + + + +/**foreach (var type in Enum.GetValues()) +{ + if (IllumilibLighting.IsEnabled(type)) + Console.WriteLine($"{type} lighting is enabled"); +} + +/** +Console.WriteLine("Setting all lights to blue"); +IllumilibLighting.SetAllLighting(0, 0, 1); +Thread.Sleep(TimeSpan.FromSeconds(3)); +IllumilibLighting.SetAllLighting(0, 0, 0); + +Console.WriteLine("Setting specific positions"); +IllumilibLighting.SetKeyboardLighting(6, 1, 1, 0, 1); +IllumilibLighting.SetKeyboardLighting(16, 5, 1, 0, 1); +Thread.Sleep(TimeSpan.FromSeconds(5)); +IllumilibLighting.SetKeyboardLighting(0, 0, 0); +IllumilibLighting.SetKeyboardLighting(8, 2, 2, 2, 0, 1, 0); +Thread.Sleep(TimeSpan.FromSeconds(5)); +IllumilibLighting.SetKeyboardLighting(0, 0, 0); + +Console.WriteLine("Doing a fun effect"); +for (var x = 0; x < IllumilibLighting.KeyboardWidth; x++) +{ + IllumilibLighting.SetKeyboardLighting(x, 0, 1, IllumilibLighting.KeyboardHeight, 0, 0, 1); + Thread.Sleep(TimeSpan.FromSeconds(0.25F)); +} +for (var x = IllumilibLighting.KeyboardWidth - 1; x >= 0; x--) +{ + IllumilibLighting.SetKeyboardLighting(x, 0, 1, IllumilibLighting.KeyboardHeight, 0, 0, 0); + Thread.Sleep(TimeSpan.FromSeconds(0.25F)); +} + +Console.WriteLine("Going through the alphabet"); +for (var i = 65; i <= 90; i++) +{ + var key = (KeyboardKeys)i; + IllumilibLighting.SetKeyboardLighting(key, 0, 1, 0); + Thread.Sleep(TimeSpan.FromSeconds(0.25F)); + IllumilibLighting.SetKeyboardLighting(key, 0, 0, 0); +} +Thread.Sleep(TimeSpan.FromSeconds(1)); + +Console.WriteLine("Pulsing"); +for (var i = 0; i < 500; i++) +{ + var value = (MathF.Sin(i / 50F * MathF.PI) + 1) / 2; + IllumilibLighting.SetAllLighting(value, 0, value); + Thread.Sleep(10); +} +IllumilibLighting.SetAllLighting(0, 0, 0); + +Console.WriteLine("Setting all supported keys"); +foreach (var key in Enum.GetValues()) +{ + IllumilibLighting.SetKeyboardLighting(key, 1, 0, 0); + Thread.Sleep(50); +} +Thread.Sleep(TimeSpan.FromSeconds(15)); +**/ +Console.WriteLine("Done"); +IllumilibLighting.Dispose(); \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..f84ba63 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "illumi-test": { + "commandName": "Project", + "commandLineArgs": "blink 10 255 0 0" + } + } +} \ No newline at end of file diff --git a/background-thingies-with-illumi.csproj b/background-thingies-with-illumi.csproj new file mode 100644 index 0000000..75f5004 --- /dev/null +++ b/background-thingies-with-illumi.csproj @@ -0,0 +1,15 @@ + + + + WinExe + net6.0 + enable + enable + RGB Thingie + + + + + + + diff --git a/background-thingies-with-illumi.sln b/background-thingies-with-illumi.sln new file mode 100644 index 0000000..3710672 --- /dev/null +++ b/background-thingies-with-illumi.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32112.339 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "background-thingies-with-illumi", "background-thingies-with-illumi.csproj", "{C197CFA1-840C-441F-AD46-19A381AB39EC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C197CFA1-840C-441F-AD46-19A381AB39EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C197CFA1-840C-441F-AD46-19A381AB39EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C197CFA1-840C-441F-AD46-19A381AB39EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C197CFA1-840C-441F-AD46-19A381AB39EC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {49364BBE-C2BE-43EA-8C4E-0FC757CBD51D} + EndGlobalSection +EndGlobal diff --git a/tiny_func/Blink.cs b/tiny_func/Blink.cs new file mode 100644 index 0000000..011cc8b --- /dev/null +++ b/tiny_func/Blink.cs @@ -0,0 +1,24 @@ +using Illumilib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace btwi.tiny_func +{ + internal class Blink + { + internal static void blinking(int duration, float r,float g, float b) + { + for (var i = 0; i < duration*100; i++) + { + var value1 = (MathF.Sin(i / r*5 * MathF.PI) + 1) / 2; + var value2 = (MathF.Sin(i / g*5 * MathF.PI) + 1) / 2; + var value3 = (MathF.Sin(i / b*5 * MathF.PI) + 1) / 2; + IllumilibLighting.SetMouseLighting(value1, value2, value3); + Thread.Sleep(10); + } + } + } +}