Awperative 1.3C

This commit is contained in:
2026-02-28 11:46:56 -05:00
parent 6e9aff9468
commit 8c3803fcdf
6 changed files with 80 additions and 71 deletions

View File

@@ -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;
}
}

View File

@@ -2,8 +2,6 @@ namespace AwperativeKernel;
public abstract partial class Component
{
#region Scenes
/// <inheritdoc cref="Awperative.CreateScene"/>
public static Scene CreateScene(string __name) => Awperative.CreateScene(__name);
@@ -22,11 +20,9 @@ public abstract partial class Component
/// <inheritdock cref="Awperative.CloseScene(string)" />
public void RemoveScene(string __name) => Awperative.CloseScene(__name);
#endregion
#region Components
/// <inheritdoc cref="ComponentDocker.Move"/>
public void Move(ComponentDocker __newDocker) => ComponentDocker.Move(this, __newDocker);
#endregion
}

View File

@@ -154,7 +154,7 @@ public static class Debug
/// <param name="__parameters"> Names of values to debug</param>
/// <param name="__values"> Values to debug</param>
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);
}
/// <summary>
@@ -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,
}
}

View File

@@ -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,42 +13,37 @@ namespace AwperativeKernel;
/// Initiating class of Awperative. Call Start() to start the kernel.
/// </summary>
/// <author> Avery Norris </author>
public static class Awperative
public static partial class Awperative
{
/// <summary>
/// Current Version of Awperative
/// </summary>
public static string Version = "1.2B";
public static string Version = "1.2C";
/// <summary>
/// Bottom class of Awperative. Contains the MonoGame instance.
/// Bottom class of Awperative. Contains the OpenTK Instance.
/// </summary>
public static Base Base { get; internal set; }
[NotNull, UnsafeInternal] private static Base Base;
/// <summary>
/// List of all scenes currently loaded in the kernel.
/// </summary>
public static ImmutableArray<Scene> Scenes => [.._scenes];
internal static HashSet<Scene> _scenes { get; private set; } = [];
[CalculatedProperty, CalculatedPropertyExpense("Very Low")]
public static IReadOnlyList<Scene> Scenes => [.._scenes];
[UnsafeInternal] internal static HashSet<Scene> _scenes { get; private set; } = [];
public static bool IsRunning { get; private set; } = false;
/// <summary> Displays if Awperative has Started or not </summary>
public static bool IsStarted { get; private set; } = false;
public static bool DebugMode = false;
/// <summary> Displays if the update loop is active</summary>
public static bool IsRunning { get; private set; } = false;
/// <summary>
@@ -87,7 +81,7 @@ public static class Awperative
/// Closes a Scene
/// </summary>
/// <param name="__scene"> Scene to close</param>
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
/// </summary>
/// <param name="__name"> Name of the scene</param>
public static void CloseScene(string __name) => Scenes.Remove(GetScene(__name));
public static void CloseScene(string __name) => _scenes.Remove(GetScene(__name));
/// <summary>
/// Gets Awperative ready to roll!
/// Gets Awperative ready to begin! Compiles Component functions etc. Please call before doing anything Awperative
/// related!
/// </summary>
/// <param name="__hooks"> List of all event hooks you wish to use. </param>
/// <remarks> You cannot add new hooks later; so make sure to register all of them in the Start() method.</remarks>
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
/// <summary>
/// Starts Awperative up! This method runs forever.
/// </summary>
[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<Type, Action<Component>[]> _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,
}
}

View File

@@ -30,3 +30,17 @@ A few modules have been given documentation and the website is currently underwa
Awperative is officially moved to Open TK!
# Awperative V1.2B
### Feb 21 2026
---
Beta Reflection And Speed Increasment
# Awperative V1.2C
### Feb 28 2026
---
Finished Reflection, and Awperative is MUCH faster.