mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added some views, I really just need this code on adifferent machine
This commit is contained in:
1 parent
2330644062
commit
1ae5a18c8e
20 files changed
+267
-117
No files matched your search
@@ -58,7 +58,7 @@ namespace Artemis.Core.Services
|
||||
// Render all active modules
|
||||
using (var g = _rgbService.GraphicsDecorator.GetGraphics())
|
||||
{
|
||||
g.Clear(Color.Red);
|
||||
g.Clear(Color.Black);
|
||||
|
||||
foreach (var module in _pluginService.Plugins.Select(p => p.Plugin).OfType<IModule>())
|
||||
module.Render(args.DeltaTime, _rgbService.Surface, g);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.RGB.NET;
|
||||
@@ -13,6 +14,7 @@ namespace Artemis.Core.Services
|
||||
public class RgbService : IRgbService, IDisposable
|
||||
{
|
||||
private readonly TimerUpdateTrigger _updateTrigger;
|
||||
private List<IRGBDevice> _loadedDevices;
|
||||
|
||||
public RgbService()
|
||||
{
|
||||
@@ -22,6 +24,7 @@ namespace Artemis.Core.Services
|
||||
// Let's throw these for now
|
||||
Surface.Exception += SurfaceOnException;
|
||||
|
||||
_loadedDevices = new List<IRGBDevice>();
|
||||
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / 30};
|
||||
Surface.RegisterUpdateTrigger(_updateTrigger);
|
||||
}
|
||||
@@ -31,6 +34,7 @@ namespace Artemis.Core.Services
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBSurface Surface { get; set; }
|
||||
|
||||
public GraphicsDecorator GraphicsDecorator { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -53,10 +57,24 @@ namespace Artemis.Core.Services
|
||||
|
||||
// TODO SpoinkyNL 8-1-18: Load alignment
|
||||
Surface.AlignDevices();
|
||||
|
||||
lock (_loadedDevices)
|
||||
{
|
||||
foreach (var surfaceDevice in Surface.Devices)
|
||||
{
|
||||
if (!_loadedDevices.Contains(surfaceDevice))
|
||||
{
|
||||
_loadedDevices.Add(surfaceDevice);
|
||||
OnDeviceLoaded(new DeviceEventArgs(surfaceDevice));
|
||||
}
|
||||
else
|
||||
OnDeviceReloaded(new DeviceEventArgs(surfaceDevice));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Apply the application wide brush and decorator
|
||||
var background = new ListLedGroup(Surface.Leds) { Brush = new SolidColorBrush(new Color(255, 255, 255, 255)) };
|
||||
var background = new ListLedGroup(Surface.Leds) {Brush = new SolidColorBrush(new Color(255, 255, 255, 255))};
|
||||
GraphicsDecorator = new GraphicsDecorator(background);
|
||||
background.Brush.AddDecorator(GraphicsDecorator);
|
||||
|
||||
|
||||
Reference in new issue
Block a user