diff --git a/Capy64/API/IPlugin.cs b/Capy64/API/IComponent.cs similarity index 96% rename from Capy64/API/IPlugin.cs rename to Capy64/API/IComponent.cs index f2fceef..61d670c 100644 --- a/Capy64/API/IPlugin.cs +++ b/Capy64/API/IComponent.cs @@ -18,7 +18,7 @@ using Microsoft.Extensions.DependencyInjection; namespace Capy64.API; -public interface IPlugin +public interface IComponent { void ConfigureServices(IServiceCollection services) { } void LuaInit(Lua L) { } diff --git a/Capy64/Capy64.cs b/Capy64/Capy64.cs index 986d881..e1aeec7 100644 --- a/Capy64/Capy64.cs +++ b/Capy64/Capy64.cs @@ -41,8 +41,8 @@ public class Capy64 : Game, IGame "Capy64"); public static Capy64 Instance { get; private set; } public Capy64 Game => this; - public IList NativePlugins { get; private set; } - public IList Plugins { get; private set; } + public IList NativePlugins { get; private set; } + public IList Plugins { get; private set; } public int Width { get; set; } = 400; public int Height { get; set; } = 300; public float Scale { get; set; } = 2f; @@ -159,18 +159,18 @@ public class Capy64 : Game, IGame base.Initialize(); } - private List GetNativePlugins() + private List GetNativePlugins() { - var iType = typeof(IPlugin); + var iType = typeof(IComponent); var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => iType.IsAssignableFrom(p) && !p.IsInterface); - var plugins = new List(); + var plugins = new List(); foreach (var type in types) { - var instance = (IPlugin)ActivatorUtilities.CreateInstance(_serviceProvider, type)!; + var instance = (IComponent)ActivatorUtilities.CreateInstance(_serviceProvider, type)!; plugins.Add(instance); } return plugins; diff --git a/Capy64/IGame.cs b/Capy64/IGame.cs index 858bad1..d0454ba 100644 --- a/Capy64/IGame.cs +++ b/Capy64/IGame.cs @@ -27,8 +27,8 @@ namespace Capy64; public interface IGame { Capy64 Game { get; } - IList NativePlugins { get; } - IList Plugins { get; } + IList NativePlugins { get; } + IList Plugins { get; } GameWindow Window { get; } Drawing Drawing { get; } Audio Audio { get; } diff --git a/Capy64/Integrations/DiscordIntegration.cs b/Capy64/Integrations/DiscordIntegration.cs index 1d141b3..20ad634 100644 --- a/Capy64/Integrations/DiscordIntegration.cs +++ b/Capy64/Integrations/DiscordIntegration.cs @@ -27,7 +27,7 @@ using System.Threading.Tasks; namespace Capy64.Integrations; -public class DiscordIntegration : IPlugin +public class DiscordIntegration : IComponent { public DiscordRpcClient Client { get; private set; } private readonly IConfiguration _configuration; diff --git a/Capy64/PluginManager/PluginLoader.cs b/Capy64/PluginManager/PluginLoader.cs index df3b1e1..cf5e1f3 100644 --- a/Capy64/PluginManager/PluginLoader.cs +++ b/Capy64/PluginManager/PluginLoader.cs @@ -33,21 +33,21 @@ internal class PluginLoader return loadContext.LoadFromAssemblyName(new AssemblyName(Path.GetFileNameWithoutExtension(path))); } - public static List LoadAllPlugins(string pluginsPath, IServiceProvider provider) + public static List LoadAllPlugins(string pluginsPath, IServiceProvider provider) { if (!Directory.Exists(pluginsPath)) Directory.CreateDirectory(pluginsPath); - var plugins = new List(); + var plugins = new List(); foreach (var fileName in Directory.GetFiles(pluginsPath).Where(q => q.EndsWith(".dll"))) { var assembly = LoadPlugin(fileName); foreach (Type type in assembly.GetTypes()) { - if (typeof(IPlugin).IsAssignableFrom(type)) + if (typeof(IComponent).IsAssignableFrom(type)) { - IPlugin result = ActivatorUtilities.CreateInstance(provider, type) as IPlugin; + IComponent result = ActivatorUtilities.CreateInstance(provider, type) as IComponent; plugins.Add(result); } } diff --git a/Capy64/Runtime/Libraries/Audio.cs b/Capy64/Runtime/Libraries/Audio.cs index 90156a0..87c472a 100644 --- a/Capy64/Runtime/Libraries/Audio.cs +++ b/Capy64/Runtime/Libraries/Audio.cs @@ -22,7 +22,7 @@ using static Capy64.Core.Audio; namespace Capy64.Runtime.Libraries; -public class Audio : IPlugin +public class Audio : IComponent { private const int queueLimit = 8; diff --git a/Capy64/Runtime/Libraries/Event.cs b/Capy64/Runtime/Libraries/Event.cs index 985f208..4236498 100644 --- a/Capy64/Runtime/Libraries/Event.cs +++ b/Capy64/Runtime/Libraries/Event.cs @@ -23,7 +23,7 @@ using System.Threading.Tasks; namespace Capy64.Runtime.Libraries; -public class Event : IPlugin +public class Event : IComponent { private static IGame _game; public Event(IGame game) diff --git a/Capy64/Runtime/Libraries/FileSystem.cs b/Capy64/Runtime/Libraries/FileSystem.cs index 862aadb..1146661 100644 --- a/Capy64/Runtime/Libraries/FileSystem.cs +++ b/Capy64/Runtime/Libraries/FileSystem.cs @@ -25,7 +25,7 @@ using Capy64.Runtime.Objects; namespace Capy64.Runtime.Libraries; -public class FileSystem : IPlugin +public class FileSystem : IComponent { public static string DataPath = Path.Combine(Capy64.AppDataPath, "data"); diff --git a/Capy64/Runtime/Libraries/GPU.cs b/Capy64/Runtime/Libraries/GPU.cs index d31873b..d6c0acc 100644 --- a/Capy64/Runtime/Libraries/GPU.cs +++ b/Capy64/Runtime/Libraries/GPU.cs @@ -24,7 +24,7 @@ using System.IO; namespace Capy64.Runtime.Libraries; -public class GPU : IPlugin +public class GPU : IComponent { private static IGame _game; diff --git a/Capy64/Runtime/Libraries/HTTP.cs b/Capy64/Runtime/Libraries/HTTP.cs index d4044d7..b922295 100644 --- a/Capy64/Runtime/Libraries/HTTP.cs +++ b/Capy64/Runtime/Libraries/HTTP.cs @@ -28,7 +28,7 @@ using System.Threading; namespace Capy64.Runtime.Libraries; #nullable enable -public class HTTP : IPlugin +public class HTTP : IComponent { private static IGame _game; private static HttpClient _httpClient; diff --git a/Capy64/Runtime/Libraries/Machine.cs b/Capy64/Runtime/Libraries/Machine.cs index 78f3426..55224d6 100644 --- a/Capy64/Runtime/Libraries/Machine.cs +++ b/Capy64/Runtime/Libraries/Machine.cs @@ -25,7 +25,7 @@ using System.Threading.Tasks; namespace Capy64.Runtime.Libraries; -public class Machine : IPlugin +public class Machine : IComponent { private static IGame _game; public Machine(IGame game) @@ -103,13 +103,6 @@ public class Machine : IPlugin if (!L.IsNoneOrNil(1)) { var newTitle = L.CheckString(1); - - if (string.IsNullOrEmpty(newTitle)) - { - newTitle = "Capy64 " + Capy64.Version; - } - - newTitle = newTitle[..Math.Min(newTitle.Length, 256)]; Capy64.Instance.Window.Title = newTitle; } diff --git a/Capy64/Runtime/Libraries/OS.cs b/Capy64/Runtime/Libraries/OS.cs index 173deae..5802ab1 100644 --- a/Capy64/Runtime/Libraries/OS.cs +++ b/Capy64/Runtime/Libraries/OS.cs @@ -19,7 +19,7 @@ using System; namespace Capy64.Runtime.Libraries; -public class OS : IPlugin +public class OS : IComponent { private static IGame _game; public OS(IGame game) diff --git a/Capy64/Runtime/Libraries/Term.cs b/Capy64/Runtime/Libraries/Term.cs index 3fb0251..d98932a 100644 --- a/Capy64/Runtime/Libraries/Term.cs +++ b/Capy64/Runtime/Libraries/Term.cs @@ -26,7 +26,7 @@ using static System.Formats.Asn1.AsnWriter; namespace Capy64.Runtime.Libraries; -internal class Term : IPlugin +internal class Term : IComponent { private struct Char { diff --git a/Capy64/Runtime/Libraries/Timer.cs b/Capy64/Runtime/Libraries/Timer.cs index 3c9162b..54ed8b8 100644 --- a/Capy64/Runtime/Libraries/Timer.cs +++ b/Capy64/Runtime/Libraries/Timer.cs @@ -21,7 +21,7 @@ using System.Collections.Generic; namespace Capy64.Runtime.Libraries; -class Timer : IPlugin +class Timer : IComponent { private LuaRegister[] TimerLib = new LuaRegister[] { diff --git a/Capy64/Runtime/LuaState.cs b/Capy64/Runtime/LuaState.cs index 654a228..3836463 100644 --- a/Capy64/Runtime/LuaState.cs +++ b/Capy64/Runtime/LuaState.cs @@ -75,7 +75,7 @@ public class LuaState : IDisposable private void InitPlugins() { - var allPlugins = new List(Capy64.Instance.NativePlugins); + var allPlugins = new List(Capy64.Instance.NativePlugins); allPlugins.AddRange(Capy64.Instance.Plugins); foreach (var plugin in allPlugins) { diff --git a/Capy64/Runtime/ObjectManager.cs b/Capy64/Runtime/ObjectManager.cs index 1a70697..da3dc13 100644 --- a/Capy64/Runtime/ObjectManager.cs +++ b/Capy64/Runtime/ObjectManager.cs @@ -26,7 +26,7 @@ using System.Threading.Tasks; namespace Capy64.Runtime; -public class ObjectManager : IPlugin +public class ObjectManager : IComponent { private static ConcurrentDictionary _objects = new(); diff --git a/Capy64/Runtime/Objects/FileHandle.cs b/Capy64/Runtime/Objects/FileHandle.cs index a3a0440..58ec924 100644 --- a/Capy64/Runtime/Objects/FileHandle.cs +++ b/Capy64/Runtime/Objects/FileHandle.cs @@ -24,7 +24,7 @@ using System.Threading.Tasks; namespace Capy64.Runtime.Objects; -public class FileHandle : IPlugin +public class FileHandle : IComponent { public const string ObjectType = "file"; diff --git a/Capy64/Runtime/Objects/GPUBuffer.cs b/Capy64/Runtime/Objects/GPUBuffer.cs index a57e37f..743dd62 100644 --- a/Capy64/Runtime/Objects/GPUBuffer.cs +++ b/Capy64/Runtime/Objects/GPUBuffer.cs @@ -20,7 +20,7 @@ using System.IO; namespace Capy64.Runtime.Objects; -public class GPUBuffer : IPlugin +public class GPUBuffer : IComponent { public const string ObjectType = "GPUBuffer"; diff --git a/Capy64/Runtime/Objects/WebSocketClient.cs b/Capy64/Runtime/Objects/WebSocketClient.cs index 030d86e..4bae376 100644 --- a/Capy64/Runtime/Objects/WebSocketClient.cs +++ b/Capy64/Runtime/Objects/WebSocketClient.cs @@ -23,7 +23,7 @@ using System.Threading; namespace Capy64.Runtime.Objects; -public class WebSocketClient : IPlugin +public class WebSocketClient : IComponent { public const string ObjectType = "WebSocketClient"; diff --git a/Capy64/Runtime/RuntimeManager.cs b/Capy64/Runtime/RuntimeManager.cs index 0767ea0..0d5dfb6 100644 --- a/Capy64/Runtime/RuntimeManager.cs +++ b/Capy64/Runtime/RuntimeManager.cs @@ -30,7 +30,7 @@ using System.Threading.Tasks; namespace Capy64.Runtime; -internal class RuntimeManager : IPlugin +internal class RuntimeManager : IComponent { private LuaState luaState; private EventEmitter emitter; diff --git a/ExamplePlugin/MyPlugin.cs b/ExamplePlugin/MyPlugin.cs index 05eb4bf..d5e4b28 100644 --- a/ExamplePlugin/MyPlugin.cs +++ b/ExamplePlugin/MyPlugin.cs @@ -4,7 +4,7 @@ using KeraLua; namespace ExamplePlugin; -public class MyPlugin : IPlugin +public class MyPlugin : IComponent { private static IGame _game; public MyPlugin(IGame game)