mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Added GDI-based rendering test
This commit is contained in:
1 parent
dd82a945ef
commit
e6f5dde7f7
21 files changed
+382
-111
No files matched your search
@@ -5,6 +5,7 @@ using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Core;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
@@ -19,6 +20,7 @@ namespace Artemis.Core.Services
|
||||
_rgbService = rgbService;
|
||||
_rgbService.Surface.Updating += SurfaceOnUpdating;
|
||||
|
||||
|
||||
Task.Run(Initialize);
|
||||
}
|
||||
|
||||
@@ -47,11 +49,20 @@ namespace Artemis.Core.Services
|
||||
try
|
||||
{
|
||||
// Update all active modules
|
||||
foreach (var module in _pluginService.Plugins.OfType<IModule>())
|
||||
foreach (var module in _pluginService.Plugins.Select(p => p.Plugin).OfType<IModule>())
|
||||
module.Update(args.DeltaTime);
|
||||
|
||||
if (_rgbService.GraphicsDecorator == null)
|
||||
return;
|
||||
|
||||
// Render all active modules
|
||||
foreach (var module in _pluginService.Plugins.OfType<IModule>())
|
||||
module.Render(args.DeltaTime, _rgbService.Surface);
|
||||
using (var g = _rgbService.GraphicsDecorator.GetGraphics())
|
||||
{
|
||||
g.Clear(Color.Red);
|
||||
|
||||
foreach (var module in _pluginService.Plugins.Select(p => p.Plugin).OfType<IModule>())
|
||||
module.Render(args.DeltaTime, _rgbService.Surface, g);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.RGB.NET;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core.Services.Interfaces
|
||||
@@ -9,6 +10,7 @@ namespace Artemis.Core.Services.Interfaces
|
||||
{
|
||||
bool LoadingDevices { get; }
|
||||
RGBSurface Surface { get; set; }
|
||||
GraphicsDecorator GraphicsDecorator { get; }
|
||||
Task LoadDevices();
|
||||
void Dispose();
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.RGB.NET;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Brushes;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair;
|
||||
using RGB.NET.Groups;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
@@ -28,6 +31,7 @@ namespace Artemis.Core.Services
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBSurface Surface { get; set; }
|
||||
public GraphicsDecorator GraphicsDecorator { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task LoadDevices()
|
||||
@@ -51,6 +55,11 @@ namespace Artemis.Core.Services
|
||||
Surface.AlignDevices();
|
||||
});
|
||||
|
||||
// Apply the application wide brush and decorator
|
||||
var background = new ListLedGroup(Surface.Leds) { Brush = new SolidColorBrush(new Color(255, 255, 255, 255)) };
|
||||
GraphicsDecorator = new GraphicsDecorator(background);
|
||||
background.Brush.AddDecorator(GraphicsDecorator);
|
||||
|
||||
OnFinishedLoadedDevices();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user