diff --git a/RGB.NET.Sandbox/Program.cs b/RGB.NET.Sandbox/Program.cs new file mode 100644 index 00000000..3a50ff00 --- /dev/null +++ b/RGB.NET.Sandbox/Program.cs @@ -0,0 +1,56 @@ +using System.Diagnostics; +using RGB.NET.Core; +using RGB.NET.Presets.Decorators; +using RGB.NET.Presets.Textures; +using RGB.NET.Presets.Textures.Gradients; + +namespace RGB.NET.Sandbox; + +internal class Program +{ + public static void Main(string[] args) + { + long before = Stopwatch.GetTimestamp(); + + AbstractRGBDeviceProvider[] deviceProviders = [ + Devices.Wooting.WootingDeviceProvider.Instance, + //Add more device providers here + ]; + + RGBSurface surface = new(); + TimerUpdateTrigger timer = new() { UpdateFrequency = 1d / 60 }; + + surface.RegisterUpdateTrigger(timer); + + surface.Exception += a => { Console.WriteLine(a.Exception.Message); }; + + foreach (AbstractRGBDeviceProvider dp in deviceProviders) + { + dp.Exception += (a, b) => { Console.WriteLine(b.Exception.Message); }; + dp.Initialize(); + foreach (IRGBDevice device in dp.Devices) + { + Console.WriteLine(device.DeviceInfo.DeviceName); + } + + surface.Attach(dp.Devices); + } + + TimeSpan after = Stopwatch.GetElapsedTime(before); + Console.WriteLine($"Initialized in {after.TotalMilliseconds} ms"); + + ILedGroup group = new ListLedGroup(surface, surface.Leds); + IGradient gradient = new RainbowGradient(); + gradient.AddDecorator(new MoveGradientDecorator(surface, 500)); + group.Brush = new TextureBrush(new LinearGradientTexture(new Size(1, 1), gradient)); + + Console.ReadLine(); + + foreach (AbstractRGBDeviceProvider dp in deviceProviders) + { + dp.Dispose(); + } + + surface.Dispose(); + } +} diff --git a/RGB.NET.Sandbox/RGB.NET.Sandbox.csproj b/RGB.NET.Sandbox/RGB.NET.Sandbox.csproj new file mode 100644 index 00000000..1577738c --- /dev/null +++ b/RGB.NET.Sandbox/RGB.NET.Sandbox.csproj @@ -0,0 +1,33 @@ + + + Exe + net9.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RGB.NET.sln b/RGB.NET.sln index 44b786e5..142a5ff1 100644 --- a/RGB.NET.sln +++ b/RGB.NET.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.1.32407.343 @@ -51,6 +51,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Corsair_Leg EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.WLED", "RGB.NET.Devices.WLED\RGB.NET.Devices.WLED.csproj", "{C533C5EA-66A8-4826-A814-80791E7593ED}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Sandbox", "RGB.NET.Sandbox\RGB.NET.Sandbox.csproj", "{BA099D3B-1B54-43D7-BCBE-18182CA91F28}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -145,6 +147,10 @@ Global {C533C5EA-66A8-4826-A814-80791E7593ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {C533C5EA-66A8-4826-A814-80791E7593ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {C533C5EA-66A8-4826-A814-80791E7593ED}.Release|Any CPU.Build.0 = Release|Any CPU + {BA099D3B-1B54-43D7-BCBE-18182CA91F28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA099D3B-1B54-43D7-BCBE-18182CA91F28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA099D3B-1B54-43D7-BCBE-18182CA91F28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA099D3B-1B54-43D7-BCBE-18182CA91F28}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE