Skip to content

Commit be3f2bf

Browse files
authored
Merge pull request #287 from DarthAffe/Development
v1.0
2 parents 25534c1 + b8b2343 commit be3f2bf

File tree

541 files changed

+38840
-28236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

541 files changed

+38840
-28236
lines changed

.github/workflows/ci.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: RGB.NET-CI
2+
3+
on:
4+
push:
5+
branches: [ Development ]
6+
paths:
7+
- '**.cs'
8+
- '**.csproj'
9+
- '**.yml'
10+
11+
jobs:
12+
build:
13+
14+
runs-on: windows-2022
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v1
22+
with:
23+
dotnet-version: 7.0.x
24+
- name: Git Semantic Version
25+
id: versioning
26+
uses: PaulHatch/[email protected]
27+
with:
28+
short_tags: false
29+
format: "${major}.${minor}.${patch}-prerelease.${increment}"
30+
- name: Restore dependencies
31+
run: dotnet restore
32+
- name: Build
33+
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.versioning.outputs.version }}
34+
- name: Test
35+
run: dotnet test --no-build --verbosity normal --configuration Release
36+
- name: Upload a Build Artifact NET5
37+
uses: actions/[email protected]
38+
with:
39+
name: RGB.NET-NET5
40+
path: bin/net5.0/RGB.NET.*.dll
41+
if-no-files-found: error
42+
- name: Upload a Build Artifact NET6
43+
uses: actions/[email protected]
44+
with:
45+
name: RGB.NET-NET6
46+
path: bin/net6.0/RGB.NET.*.dll
47+
if-no-files-found: error
48+
- name: Upload a Build Artifact NET7
49+
uses: actions/[email protected]
50+
with:
51+
name: RGB.NET-NET7
52+
path: bin/net7.0/RGB.NET.*.dll
53+
if-no-files-found: error
54+
- name: Upload Nuget Build Artifact
55+
uses: actions/[email protected]
56+
with:
57+
name: RGB.NET-Nugets
58+
path: bin/*nupkg
59+
if-no-files-found: error
60+
- name: Nuget Push
61+
run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json

.github/workflows/pr_verify.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: PR-Verify
2+
3+
on:
4+
pull_request:
5+
branches: [ master, Development ]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: windows-2022
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v1
16+
with:
17+
dotnet-version: 7.0.x
18+
- name: Restore dependencies
19+
run: dotnet restore
20+
- name: Build
21+
run: dotnet build --no-restore --configuration Release /p:Version=0.0.0
22+
- name: Test
23+
run: dotnet test --no-build --verbosity normal --configuration Release
24+

.github/workflows/release.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: RGB.NET-Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- '**.cs'
8+
- '**.csproj'
9+
- '**.yml'
10+
11+
jobs:
12+
build:
13+
runs-on: windows-2022
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: 7.0.x
23+
- name: Git Semantic Version
24+
id: versioning
25+
uses: PaulHatch/[email protected]
26+
with:
27+
short_tags: false
28+
format: "${major}.${minor}.${patch}"
29+
- name: Restore dependencies
30+
run: dotnet restore
31+
- name: Build
32+
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.versioning.outputs.version }}
33+
- name: Test
34+
run: dotnet test --no-build --verbosity normal --configuration Release
35+
- name: Upload a Build Artifact NET5
36+
uses: actions/[email protected]
37+
with:
38+
name: RGB.NET-NET5
39+
path: bin/net5.0/RGB.NET.*.dll
40+
if-no-files-found: error
41+
- name: Upload a Build Artifact NET6
42+
uses: actions/[email protected]
43+
with:
44+
name: RGB.NET-NET6
45+
path: bin/net6.0/RGB.NET.*.dll
46+
if-no-files-found: error
47+
- name: Upload a Build Artifact NET7
48+
uses: actions/[email protected]
49+
with:
50+
name: RGB.NET-NET7
51+
path: bin/net7.0/RGB.NET.*.dll
52+
if-no-files-found: error
53+
- name: Upload Nuget Build Artifact
54+
uses: actions/[email protected]
55+
with:
56+
name: RGB.NET-Nugets
57+
path: bin/*nupkg
58+
if-no-files-found: error
59+
- name: Release
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
tag_name: ${{ steps.versioning.outputs.version_tag }}
63+
generate_release_notes: true
64+
files: bin/net7.0/RGB.NET.*.dll
65+
- name: Nuget Push
66+
run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json

Documentation/DeviceLayout.xsd

+14-27
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@
77
<xsd:element name="Description" type="xsd:string" />
88
<xsd:element name="Author" type="xsd:string" />
99
<xsd:element name="Type" type="xsd:string" />
10-
<xsd:element name="Lighting" type="xsd:string" />
1110
<xsd:element name="Vendor" type="xsd:string" />
1211
<xsd:element name="Model" type="xsd:string" />
1312
<xsd:element name="Shape" type="xsd:string" />
1413
<xsd:element name="Width" type="xsd:double" />
1514
<xsd:element name="Height" type="xsd:double" />
16-
<xsd:element name="ImageBasePath" type="xsd:string" />
17-
<xsd:element name="DeviceImage" type="xsd:string" />
1815
<xsd:element name="LedUnitWidth" type="xsd:double" />
1916
<xsd:element name="LedUnitHeight" type="xsd:double" />
20-
<xsd:element name="Leds">
17+
<xsd:element name="CustomData">
18+
<xsd:complexType>
19+
<xsd:sequence>
20+
<xsd:any />
21+
</xsd:sequence>
22+
</xsd:complexType>
23+
</xsd:element>
24+
25+
<xsd:element name="Leds">
2126
<xsd:complexType>
2227
<xsd:sequence>
2328
<xsd:element maxOccurs="unbounded" name="Led">
@@ -28,39 +33,21 @@
2833
<xsd:element name="Y" type="xsd:string" />
2934
<xsd:element name="Width" type="xsd:string" />
3035
<xsd:element name="Height" type="xsd:string" />
31-
</xsd:sequence>
32-
<xsd:attribute name="Id" type="xsd:string" use="required" />
33-
</xsd:complexType>
34-
</xsd:element>
35-
</xsd:sequence>
36-
</xsd:complexType>
37-
</xsd:element>
38-
<xsd:element name="LedImageLayouts">
39-
<xsd:complexType>
40-
<xsd:sequence>
41-
<xsd:element maxOccurs="unbounded" name="LedImageLayout">
42-
<xsd:complexType>
43-
<xsd:sequence>
44-
<xsd:element name="LedImages">
36+
<xsd:element name="CustomData">
4537
<xsd:complexType>
46-
<xsd:sequence>
47-
<xsd:element maxOccurs="unbounded" name="LedImage">
48-
<xsd:complexType>
49-
<xsd:attribute name="Id" type="xsd:string" use="required" />
50-
<xsd:attribute name="Image" type="xsd:string" use="required" />
51-
</xsd:complexType>
52-
</xsd:element>
38+
<xsd:sequence>
39+
<xsd:any />
5340
</xsd:sequence>
5441
</xsd:complexType>
5542
</xsd:element>
5643
</xsd:sequence>
57-
<xsd:attribute name="Layout" type="xsd:string" />
44+
<xsd:attribute name="Id" type="xsd:string" use="required" />
5845
</xsd:complexType>
5946
</xsd:element>
6047
</xsd:sequence>
6148
</xsd:complexType>
6249
</xsd:element>
63-
</xsd:sequence>
50+
</xsd:sequence>
6451
</xsd:complexType>
6552
</xsd:element>
6653
</xs:schema>

README.md

+76-19
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,87 @@
11
# RGB.NET
2+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/DarthAffe/RGB.NET?style=for-the-badge)](https://github.com/DarthAffe/RGB.NET/releases)
3+
[![Nuget](https://img.shields.io/nuget/v/RGB.NET.Core?style=for-the-badge)](https://www.nuget.org/packages?q=rgb.net)
4+
[![GitHub](https://img.shields.io/github/license/DarthAffe/RGB.NET?style=for-the-badge)](https://github.com/DarthAffe/RGB.NET/blob/master/LICENSE)
5+
[![GitHub Repo stars](https://img.shields.io/github/stars/DarthAffe/RGB.NET?style=for-the-badge)](https://github.com/DarthAffe/RGB.NET/stargazers)
6+
[![Discord](https://img.shields.io/discord/366163308941934592?logo=discord&logoColor=white&style=for-the-badge)](https://discord.gg/9kytURv)
27

3-
This project aims to unify the use of various RGB-devices.
4-
**It is currently under heavy development and will have breaking changes in the future!** Right now a lot of devices aren't working as expected and there are bugs/unfinished features. Please think about that when you consider using the library in this early stage.
5-
6-
If you want to help with layouting/testing devices or if you need support using the library feel free to join the [RGB.NET discord-channel](https://discord.gg/9kytURv).
8+
> **IMPORTANT NOTE**
9+
This is a library to integrate RGB-devices into your own application. It does not contain any executables!
10+
If you're looking for a full blown software solution to manage your RGB-devices, take a look at [Artemis](https://artemis-rgb.com/).
711

12+
## Getting Started
13+
### Setup
14+
1. Add the [RGB.NET.Core](https://www.nuget.org/packages/RGB.NET.Core) and [Devices](https://www.nuget.org/packages?q=rgb.net.Devices)-Nugets for all devices you want to use.
15+
2. For some of the vendors SDK-libraries are needed. Check the contained Readmes for more information in that case.
16+
3. Create a new `RGBSurface`.
17+
```csharp
18+
RGBSurface surface = new RGBSurface();
19+
```
820

9-
## Adding prerelease packages using NuGet ##
10-
This is the easiest and therefore preferred way to include RGB.NET in your project.
21+
4. Initialize the providers for all devices you want to use and add the devices to the surface. For example:
22+
```csharp
23+
CorsairDeviceProvider.Instance.Initialize(throwExceptions: true);
24+
surface.Attach(CorsairDeviceProvider.Instance.Devices);
25+
```
26+
The `Initialize`-method allows to load only devices of specific types by setting a filter and for debugging purposes allows to enable exception throwing. (By default they are catched and provided through the `Exception`-event.)
27+
You can also use the `Load`-Extension on the surface.
28+
```csharp
29+
surface.Load(CorsairDeviceProvider.Instance);
30+
```
31+
> While most device-providers are implemented in a way that supports fast loading like this some may have a different loading procedures. (For example the `WS281XDeviceProvider` requires device-definitions before loading.)
1132
12-
Since there aren't any release-packages right now you'll have to use the CI-feed from [http://nuget.arge.be](http://nuget.arge.be).
13-
You can include it either by adding ```http://nuget.arge.be/v3/index.json``` to your Visual Studio package sources or by adding this [NuGet.Config](https://github.com/DarthAffe/RGB.NET/tree/master/Documentation/NuGet.Config) to your project (at the same level as your solution).
33+
5. Add an update-trigger. In most cases the TimerUpdateTrigger is preferable, but you can also implement your own to fit your needs.
34+
```csharp
35+
surface.RegisterUpdateTrigger(new TimerUpdateTrigger());
36+
```
37+
> If you want to trigger updates manually the `ManualUpdateTrigger` should be used.
1438
15-
### .NET 4.5 Support ###
16-
At the end of the year with the release of .NET 5 the support for old .NET-Framwork versions will be droppped!
17-
It's not recommended to use RGB.NET in projects targeting .NET 4.x that aren't planned to be moved to Core/.NET 5 in the future.
39+
6. *This step is optional but recommended.* For rendering the location of each LED on the surface can be important. Since not all SDKs provide useful layout-information you might want to add Layouts to your devices. (TODO: add wiki article for this)
40+
Same goes for the location of the device on the surface. If you don't care about the exact location of the devices you can use:
41+
```csharp
42+
surface.AlignDevices();
43+
```
1844

45+
The basic setup is now complete and you can start setting up your rendering.
1946

20-
### Device-Layouts
21-
To be able to have devices with correct LED-locations and sizes they need to be layouted. Pre-created layouts can be found at https://github.com/DarthAffe/RGB.NET-Resources.
47+
### Basic Rendering
48+
As an example we'll add a moving rainbow over all devices on the surface.
49+
1. Create a led-group containing all leds on the surface (all devices)
50+
```csharp
51+
ILedGroup allLeds = new ListLedGroup(surface, surface.Leds);
52+
```
2253

23-
If you plan to create layouts for your own devices check out https://github.com/DarthAffe/RGB.NET/wiki/Creating-Layouts first. There's also a layout-editor which strongly simplifies most of the work: https://github.com/SpoinkyNL/RGB.NET-Layout-Editor
54+
2. Create a rainbow-gradient.
55+
```csharp
56+
RainbowGradient rainbow = new RainbowGradient();
57+
```
2458

25-
### Example usage of RGB.NET
26-
[![Example video](https://img.youtube.com/vi/JLRa0Wv4qso/0.jpg)](http://www.youtube.com/watch?v=JLRa0Wv4qso)
59+
3. Add a decorator to the gradient to make it move. (Decorators are
60+
```csharp
61+
rainbow.AddDecorator(new MoveGradientDecorator(surface));
62+
```
2763

28-
#### Example Projects
29-
[https://github.com/DarthAffe/KeyboardAudioVisualizer](https://github.com/DarthAffe/KeyboardAudioVisualizer)
30-
[https://github.com/DarthAffe/RGBSyncPlus](https://github.com/DarthAffe/RGBSyncPlus)
64+
4. Create a texture (the size - in this example 10, 10 - is not important here since the gradient shoukd be stretched anyway)
65+
```csharp
66+
ITexture texture = new ConicalGradientTexture(new Size(10, 10), rainbow);
67+
```
68+
69+
5. Add a brush rendering the texture to the led-group
70+
```csharp
71+
allLeds.Brush = new TextureBrush(texture);
72+
```
73+
74+
### Full example
75+
```csharp
76+
RGBSurface surface = new RGBSurface();
77+
surface.Load(CorsairDeviceProvider.Instance);
78+
surface.AlignDevices();
79+
80+
surface.RegisterUpdateTrigger(new TimerUpdateTrigger());
81+
82+
ILedGroup allLeds = new ListLedGroup(surface, surface.Leds);
83+
RainbowGradient rainbow = new RainbowGradient();
84+
rainbow.AddDecorator(new MoveGradientDecorator(surface));
85+
ITexture texture = new ConicalGradientTexture(new Size(10, 10), rainbow);
86+
allLeds.Brush = new TextureBrush(texture);
87+
```

0 commit comments

Comments
 (0)