diff --git a/AwperativeKernel/Kernel/Atrributes/AwperativeAttributes.cs b/AwperativeKernel/Kernel/Atrributes/AwperativeAttributes.cs index bf232d3..95be806 100644 --- a/AwperativeKernel/Kernel/Atrributes/AwperativeAttributes.cs +++ b/AwperativeKernel/Kernel/Atrributes/AwperativeAttributes.cs @@ -31,7 +31,7 @@ public class DockerOwns : Attribute __docker.GetHashCode().ToString("N0") ]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -62,7 +62,7 @@ public class DockerDoesntOwn : Attribute __docker.GetHashCode().ToString("N0") ]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -94,7 +94,7 @@ public class OrphanComponent : Attribute __component.ComponentDocker.GetHashCode().ToString("N0") ]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -118,7 +118,7 @@ public class ComponentNotNull : Attribute Debug.LogError("Component is null!"); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -142,7 +142,7 @@ public class DockerNotNull : Attribute Debug.LogError("Docker is null!"); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -165,7 +165,7 @@ public class SceneNotNull : Attribute Debug.LogError("Scene is null!"); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -188,7 +188,7 @@ public class CollectionNotNull : Attribute if (__collection[i] == null) Debug.LogError("A Given Collection has null members!", ["Type"], [__collection.GetType().Name]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -211,7 +211,7 @@ public class EnumeratorNotNull : Attribute if (obj == null) Debug.LogError("A Given Enumerator has null members!", ["Type"], [__enumerator.GetType().Name]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -236,7 +236,7 @@ public class NotNull : Attribute [__object.GetType().Name ]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -263,7 +263,7 @@ public class DifferentDocker : Attribute __docker.GetHashCode().ToString("N0") ]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -287,7 +287,7 @@ public class ValueFitsRange : Attribute Debug.LogError("Value does not fit range!", ["Index"], [__index.ToString("N0")]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -312,7 +312,7 @@ public class CollectionContains : Attribute Debug.LogError("Collection does not contain object!", ["ObjectType"], [__object.GetType().Name]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } @@ -337,7 +337,7 @@ public class CollectionDoesntContain : Attribute Debug.LogError("Collection already contains object!", ["ObjectType"], [__object.GetType().Name]); - return Awperative.IgnoreErrors; + return Debug.IgnoreErrors; } } diff --git a/AwperativeKernel/Kernel/Component/ComponentLambda.cs b/AwperativeKernel/Kernel/Component/ComponentLambda.cs index 0955931..02c0253 100644 --- a/AwperativeKernel/Kernel/Component/ComponentLambda.cs +++ b/AwperativeKernel/Kernel/Component/ComponentLambda.cs @@ -2,8 +2,6 @@ namespace AwperativeKernel; public abstract partial class Component { - #region Scenes - /// public static Scene CreateScene(string __name) => Awperative.CreateScene(__name); @@ -22,11 +20,9 @@ public abstract partial class Component /// public void RemoveScene(string __name) => Awperative.CloseScene(__name); - #endregion - #region Components + /// public void Move(ComponentDocker __newDocker) => ComponentDocker.Move(this, __newDocker); - #endregion } \ No newline at end of file diff --git a/AwperativeKernel/Kernel/Debug/Debug.cs b/AwperativeKernel/Kernel/Debug/Debug.cs index a5885ae..9575a44 100644 --- a/AwperativeKernel/Kernel/Debug/Debug.cs +++ b/AwperativeKernel/Kernel/Debug/Debug.cs @@ -154,7 +154,7 @@ public static class Debug /// Names of values to debug /// Values to debug public static void LogError(string __message, string[] __parameters, string[] __values) { - if(Awperative.DebugErrors) LogGeneric(__message, "ERR", __parameters, __values, Awperative.ThrowExceptions); + if(DebugErrors) LogGeneric(__message, "ERR", __parameters, __values, ThrowExceptions); } /// @@ -209,4 +209,28 @@ public static class Debug File.AppendAllText(LogFilePath, output); } + + + + public static Debug.SafetyLevel safetyLevel { + get => _safetyLevel; + set { + ThrowExceptions = value is Debug.SafetyLevel.Extreme; + IgnoreErrors = value is Debug.SafetyLevel.Low or Debug.SafetyLevel.None; + DebugErrors = value is not Debug.SafetyLevel.None; + _safetyLevel = value; + } + } + + private static Debug.SafetyLevel _safetyLevel; + public static bool ThrowExceptions { get; private set; } = false; + public static bool IgnoreErrors { get; private set; } = false; + public static bool DebugErrors { get; private set; } = true; + + public enum SafetyLevel { + Extreme, //Throw exceptions and stop the whole program + Normal, //Just debug it to the console, and halt current process + Low, //Push through tasks but debug error + None, //Ignore most/all errors and do not debug it, + } } \ No newline at end of file diff --git a/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs b/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs index afd337d..ec87d59 100644 --- a/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs +++ b/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Collections.ObjectModel; -using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -14,44 +13,39 @@ namespace AwperativeKernel; /// Initiating class of Awperative. Call Start() to start the kernel. /// /// Avery Norris -public static class Awperative +public static partial class Awperative { /// /// Current Version of Awperative /// - public static string Version = "1.2B"; - - - - /// - /// Bottom class of Awperative. Contains the MonoGame instance. - /// - public static Base Base { get; internal set; } - + public static string Version = "1.2C"; + + + /// + /// Bottom class of Awperative. Contains the OpenTK Instance. + /// + [NotNull, UnsafeInternal] private static Base Base; + + /// /// List of all scenes currently loaded in the kernel. /// - public static ImmutableArray Scenes => [.._scenes]; - internal static HashSet _scenes { get; private set; } = []; + [CalculatedProperty, CalculatedPropertyExpense("Very Low")] + public static IReadOnlyList Scenes => [.._scenes]; + [UnsafeInternal] internal static HashSet _scenes { get; private set; } = []; - - public static bool IsRunning { get; private set; } = false; + + /// Displays if Awperative has Started or not public static bool IsStarted { get; private set; } = false; + /// Displays if the update loop is active + public static bool IsRunning { get; private set; } = false; - - public static bool DebugMode = false; - - - - - - /// /// Creates a new Scene /// @@ -87,7 +81,7 @@ public static class Awperative /// Closes a Scene /// /// Scene to close - public static void CloseScene(Scene __scene) => Scenes.Remove(__scene); + public static void CloseScene(Scene __scene) => _scenes.Remove(__scene); @@ -95,18 +89,20 @@ public static class Awperative /// Closes a Scene /// /// Name of the scene - public static void CloseScene(string __name) => Scenes.Remove(GetScene(__name)); + public static void CloseScene(string __name) => _scenes.Remove(GetScene(__name)); /// - /// Gets Awperative ready to roll! + /// Gets Awperative ready to begin! Compiles Component functions etc. Please call before doing anything Awperative + /// related! /// - /// List of all event hooks you wish to use. - /// You cannot add new hooks later; so make sure to register all of them in the Start() method. public static void Start() { + if(IsStarted) return; + IsStarted = true; + Debug.Initiate(); //Load in all Components nd find the associated types. @@ -156,8 +152,9 @@ public static class Awperative /// /// Starts Awperative up! This method runs forever. /// - [DoesNotReturn] public static void Run() { + if(!IsStarted && IsRunning) return; + IsRunning = true; Base = new Base(); Base.Run(); } @@ -184,27 +181,5 @@ public static class Awperative internal static Dictionary[]> _TypeAssociatedTimeEvents = []; - - public static SafetyLevel safetyLevel { - get => _safetyLevel; - set { - ThrowExceptions = value is SafetyLevel.Extreme; - IgnoreErrors = value is SafetyLevel.Low or SafetyLevel.None; - DebugErrors = value is not SafetyLevel.None; - _safetyLevel = value; - } - } private static SafetyLevel _safetyLevel; - - public static bool ThrowExceptions { get; private set; } = false; - public static bool IgnoreErrors { get; private set; } = false; - public static bool DebugErrors { get; private set; } = true; - - //What to do if there is an error, keep in mind low and none still can have errors, because you are turning off validation checking - public enum SafetyLevel { - Extreme, //Throw exceptions and stop the whole program - Normal, //Just debug it to the console, and halt current process - Low, //Push through tasks but debug error - None, //Ignore most/all errors and do not debug it, - } } \ No newline at end of file diff --git a/AwperativeKernel/VersionHistory.md b/AwperativeKernel/VersionHistory.md index d0247ca..dc998b6 100644 --- a/AwperativeKernel/VersionHistory.md +++ b/AwperativeKernel/VersionHistory.md @@ -29,4 +29,18 @@ A few modules have been given documentation and the website is currently underwa Awperative is officially moved to Open TK! -# Awperative V1.2B \ No newline at end of file +# Awperative V1.2B + +### Feb 21 2026 + +--- + +Beta Reflection And Speed Increasment + +# Awperative V1.2C + +### Feb 28 2026 + +--- + +Finished Reflection, and Awperative is MUCH faster. \ No newline at end of file diff --git a/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll b/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll index 1b1cce7..4c33175 100644 Binary files a/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll and b/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll differ