-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (43 loc) · 1.66 KB
/
Program.cs
File metadata and controls
56 lines (43 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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();
}
}