mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Implemented layer elements
Added a brush layer element Corsair - Added ST100 RGB layout
This commit is contained in:
1 parent
c70c162ef0
commit
f8037feb81
81 files changed
+1610
-365
No files matched your search
+8
-5
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
@@ -8,22 +9,24 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to implement your own RGB device
|
||||
/// Allows you to implement and register your own device provider
|
||||
/// </summary>
|
||||
public abstract class Device : Plugin
|
||||
public abstract class DeviceProvider : Plugin
|
||||
{
|
||||
protected Device(PluginInfo pluginInfo, IRGBDeviceProvider deviceProvider) : base(pluginInfo)
|
||||
protected DeviceProvider(PluginInfo pluginInfo, IRGBDeviceProvider rgbDeviceProvider) : base(pluginInfo)
|
||||
{
|
||||
DeviceProvider = deviceProvider ?? throw new ArgumentNullException(nameof(deviceProvider));
|
||||
RgbDeviceProvider = rgbDeviceProvider ?? throw new ArgumentNullException(nameof(rgbDeviceProvider));
|
||||
}
|
||||
|
||||
public IRGBDeviceProvider DeviceProvider { get; }
|
||||
public IRGBDeviceProvider RgbDeviceProvider { get; }
|
||||
|
||||
|
||||
protected void ResolveAbsolutePath(Type type, object sender, ResolvePathEventArgs e)
|
||||
{
|
||||
if (sender.GetType().IsGenericType(type))
|
||||
{
|
||||
Debug.WriteLine(e.RelativePart);
|
||||
Debug.WriteLine(e.FileName);
|
||||
// Start from the plugin directory
|
||||
if (e.RelativePart != null && e.FileName != null)
|
||||
e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePart, e.FileName);
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create your own layer type
|
||||
/// </summary>
|
||||
public abstract class LayerType : Plugin
|
||||
{
|
||||
protected LayerType(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the layer type
|
||||
/// </summary>
|
||||
/// <param name="layer"></param>
|
||||
public abstract void Update(Layer layer);
|
||||
|
||||
/// <summary>
|
||||
/// Renders the layer type
|
||||
/// </summary>
|
||||
public abstract void Render(Layer device, ArtemisSurface surface, Graphics graphics);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
Module = module;
|
||||
DisplayName = displayName;
|
||||
}
|
||||
|
||||
|
||||
public Module Module { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
@@ -34,8 +35,10 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeActiveProfile(Profile profile)
|
||||
internal void ChangeActiveProfile(Profile profile, ArtemisSurface surface)
|
||||
{
|
||||
if (profile != null && profile.PluginInfo != PluginInfo)
|
||||
throw new ArtemisCoreException($"Cannot activate a profile of plugin {profile.PluginInfo} on a module of plugin {PluginInfo}.");
|
||||
lock (this)
|
||||
{
|
||||
if (profile == ActiveProfile)
|
||||
@@ -44,7 +47,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
ActiveProfile?.Deactivate();
|
||||
|
||||
ActiveProfile = profile;
|
||||
ActiveProfile?.Activate();
|
||||
ActiveProfile?.Activate(surface);
|
||||
}
|
||||
|
||||
OnActiveProfileChanged();
|
||||
@@ -53,7 +56,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
#region Events
|
||||
|
||||
public event EventHandler ActiveProfileChanged;
|
||||
|
||||
|
||||
protected virtual void OnActiveProfileChanged()
|
||||
{
|
||||
ActiveProfileChanged?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Artemis.Core.Plugins.Interfaces
|
||||
{
|
||||
public interface ILayerTypeConfiguration
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Surface;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public abstract class LayerElement
|
||||
{
|
||||
protected LayerElement(Layer layer, LayerElementSettings settings, LayerElementDescriptor descriptor)
|
||||
{
|
||||
Layer = layer;
|
||||
Settings = settings;
|
||||
Descriptor = descriptor;
|
||||
}
|
||||
|
||||
public Layer Layer { get; }
|
||||
public LayerElementSettings Settings { get; }
|
||||
public LayerElementDescriptor Descriptor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Called by the profile editor to populate the layer element properties panel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract LayerElementViewModel GetViewModel();
|
||||
|
||||
/// <summary>
|
||||
/// Called before rendering every frame, write your update logic here
|
||||
/// </summary>
|
||||
/// <param name="deltaTime"></param>
|
||||
public abstract void Update(double deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// Called before rendering, in the order configured on the layer
|
||||
/// </summary>
|
||||
public abstract void RenderPreProcess(ArtemisSurface surface, Graphics graphics);
|
||||
|
||||
/// <summary>
|
||||
/// Called during rendering, in the order configured on the layer
|
||||
/// </summary>
|
||||
public abstract void Render(ArtemisSurface surface, Graphics graphics);
|
||||
|
||||
/// <summary>
|
||||
/// Called after rendering, in the order configured on the layer
|
||||
/// </summary>
|
||||
public abstract void RenderPostProcess(ArtemisSurface surface, Graphics graphics);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public class LayerElementDescriptor
|
||||
{
|
||||
internal LayerElementDescriptor(string displayName, string description, string icon, Type layerElementType, LayerElementProvider layerElementProvider)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Description = description;
|
||||
Icon = icon;
|
||||
LayerElementType = layerElementType;
|
||||
LayerElementProvider = layerElementProvider;
|
||||
}
|
||||
|
||||
public string DisplayName { get; }
|
||||
public string Description { get; }
|
||||
public string Icon { get; }
|
||||
public Type LayerElementType { get; }
|
||||
public LayerElementProvider LayerElementProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create one or more <see cref="LayerElement" />s usable by profile layers.
|
||||
/// </summary>
|
||||
public abstract class LayerElementProvider : Plugin
|
||||
{
|
||||
private readonly List<LayerElementDescriptor> _layerElementDescriptors;
|
||||
|
||||
protected LayerElementProvider(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
_layerElementDescriptors = new List<LayerElementDescriptor>();
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<LayerElementDescriptor> LayerElementDescriptors => _layerElementDescriptors.AsReadOnly();
|
||||
|
||||
protected void AddLayerElementDescriptor<T>(string displayName, string description, string icon) where T : LayerElement
|
||||
{
|
||||
_layerElementDescriptors.Add(new LayerElementDescriptor(displayName, description, icon, typeof(T), this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public abstract class LayerElementSettings : PropertyChangedBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerElement
|
||||
{
|
||||
public abstract class LayerElementViewModel : PropertyChangedBase
|
||||
{
|
||||
protected LayerElementViewModel(LayerElement layerElement)
|
||||
{
|
||||
LayerElement = layerElement;
|
||||
}
|
||||
|
||||
public LayerElement LayerElement { get; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user