More core rendering

This commit is contained in:
SpoinkyNL committed 2018-04-07 14:24:49 +02:00
1 parent 9a2ea0c2b3
commit 31e9eb511b
9 files changed
+155 -44

No files matched your search

@@ -1,10 +1,14 @@
using System;
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.ProfileElements;
using RGB.NET.Core;
namespace Artemis.Core.Plugins.Abstract
{
public abstract class ProfileModule : IModule
{
public Profile ActiveProfile { get; private set; }
/// <inheritdoc />
public abstract Type ViewModelType { get; }
@@ -17,16 +21,38 @@ namespace Artemis.Core.Plugins.Abstract
// Load and activate the last active profile
}
/// <inheritdoc />
public virtual void Update(double deltaTime)
public void ChangeActiveProfile(Profile profile)
{
// Update the profile
lock (this)
{
if (profile == null)
throw new ArgumentNullException(nameof(profile));
ActiveProfile?.Deactivate();
ActiveProfile = profile;
ActiveProfile.Activate();
}
}
/// <inheritdoc />
public virtual void Render(double deltaTime)
public virtual void Update(double deltaTime)
{
// Render the profile
lock (this)
{
// Update the profile
ActiveProfile?.Update(deltaTime);
}
}
/// <inheritdoc />
public virtual void Render(double deltaTime, RGBSurface surface)
{
lock (this)
{
// Render the profile
ActiveProfile?.Render(deltaTime, surface);
}
}
/// <inheritdoc />
@@ -18,8 +18,6 @@ namespace Artemis.Core.Plugins.Interfaces
/// <summary>
/// Renders the layer type
/// </summary>
void Render(Layer device, IRGBDevice rgbDevice);
ILayerType ApplyToLayer(Layer layer);
void Render(Layer device, RGBSurface surface);
}
}
@@ -1,4 +1,5 @@
using System;
using RGB.NET.Core;
namespace Artemis.Core.Plugins.Interfaces
{
@@ -29,6 +30,7 @@ namespace Artemis.Core.Plugins.Interfaces
/// Called each frame when the module must render
/// </summary>
/// <param name="deltaTime">Time since the last render</param>
void Render(double deltaTime);
/// <param name="surface">The RGB Surface to render to</param>
void Render(double deltaTime, RGBSurface surface);
}
}
@@ -123,5 +123,10 @@ namespace Artemis.Core.Plugins.Models
vm.PluginInfo = this;
return vm;
}
public override string ToString()
{
return $"{nameof(Guid)}: {Guid}, {nameof(Name)}: {Name}, {nameof(Version)}: {Version}";
}
}
}