mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added a debugger, ironed out rendering pipeline
This commit is contained in:
1 parent
3dc8fa6b1c
commit
28fc7b5dcc
15 files changed
+321
-35
No files matched your search
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage;
|
||||
@@ -46,11 +47,17 @@ namespace Artemis.Core.Services
|
||||
throw new ArtemisCoreException("Cannot initialize the core as it is already initialized.");
|
||||
|
||||
_logger.Information("Initializing Artemis Core version {version}", typeof(CoreService).Assembly.GetName().Version);
|
||||
|
||||
|
||||
// Initialize the services
|
||||
await Task.Run(() => _pluginService.CopyBuiltInPlugins());
|
||||
await Task.Run(() => _pluginService.LoadPlugins());
|
||||
|
||||
var surfaceConfig = _surfaceService.ActiveSurfaceConfiguration;
|
||||
if (surfaceConfig != null)
|
||||
_logger.Information("Initialized with active surface configuration {surfaceConfig}-{guid}", surfaceConfig.Name, surfaceConfig.Guid);
|
||||
else
|
||||
_logger.Information("Initialized without an active surface configuration");
|
||||
|
||||
OnInitialized();
|
||||
}
|
||||
|
||||
@@ -79,6 +86,8 @@ namespace Artemis.Core.Services
|
||||
foreach (var module in modules)
|
||||
module.Render(args.DeltaTime, _rgbService.Surface, g);
|
||||
}
|
||||
|
||||
OnFrameRendered(new FrameEventArgs(modules, _rgbService.GraphicsDecorator.GetBitmap(), args.DeltaTime, _rgbService.Surface));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -89,6 +98,7 @@ namespace Artemis.Core.Services
|
||||
#region Events
|
||||
|
||||
public event EventHandler Initialized;
|
||||
public event EventHandler<FrameEventArgs> FrameRendered;
|
||||
|
||||
private void OnInitialized()
|
||||
{
|
||||
@@ -97,5 +107,10 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected virtual void OnFrameRendered(FrameEventArgs e)
|
||||
{
|
||||
FrameRendered?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Artemis.Core.Events;
|
||||
|
||||
namespace Artemis.Core.Services.Interfaces
|
||||
{
|
||||
@@ -13,5 +14,10 @@ namespace Artemis.Core.Services.Interfaces
|
||||
/// Occurs the core has finished initializing
|
||||
/// </summary>
|
||||
event EventHandler Initialized;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a frame has finished rendering
|
||||
/// </summary>
|
||||
event EventHandler<FrameEventArgs> FrameRendered;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace Artemis.Core.Services
|
||||
Surface.Exception += SurfaceOnException;
|
||||
|
||||
_loadedDevices = new List<IRGBDevice>();
|
||||
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / 30};
|
||||
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / 25};
|
||||
Surface.RegisterUpdateTrigger(_updateTrigger);
|
||||
}
|
||||
|
||||
@@ -97,10 +97,12 @@ namespace Artemis.Core.Services
|
||||
|
||||
public void UpdateGraphicsDecorator()
|
||||
{
|
||||
// TODO: Create new one first, then clean up the old one for a smoother transition
|
||||
|
||||
// Clean up the old background if present
|
||||
if (_background != null)
|
||||
{
|
||||
_background.RemoveAllDecorators();
|
||||
_background.Brush?.RemoveAllDecorators();
|
||||
_background.Detach();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,7 @@ namespace Artemis.Core.Services.Storage
|
||||
MatchDeviceConfiguration(e.Device, surfaceConfiguration);
|
||||
}
|
||||
|
||||
foreach (var deviceConfiguration in ActiveSurfaceConfiguration.DeviceConfigurations)
|
||||
deviceConfiguration.ApplyToDevice();
|
||||
UpdateSurfaceConfiguration(ActiveSurfaceConfiguration, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -169,7 +168,7 @@ namespace Artemis.Core.Services.Storage
|
||||
// When all surface configs are loaded, apply the active surface config
|
||||
var active = SurfaceConfigurations.FirstOrDefault(c => c.IsActive);
|
||||
if (active != null)
|
||||
ActiveSurfaceConfiguration = active;
|
||||
SetActiveSurfaceConfiguration(active);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user