Moved to OpenTK

This commit is contained in:
2026-02-17 20:27:18 -05:00
parent abbfe285b6
commit 3c2ad05cab
21 changed files with 475 additions and 319 deletions

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.Xna.Framework;
namespace Awperative;
namespace AwperativeKernel;
@@ -134,9 +134,9 @@ public abstract partial class Component : ComponentDocker
public void RemoveTag(string __tag) => ComponentDocker.UnhashTaggedComponent(this, __tag);
/// <summary>
/// All parent Dockers and the parents of the parents up until the Scene. Will only list parents of parents, not uncle dockers.
/// </summary>
@@ -194,4 +194,37 @@ public abstract partial class Component : ComponentDocker
}
return [..returnValue];
}
/// <summary>
/// Creates a new Scene
/// </summary>
/// <param name="__name">Name of the Scene</param>
public Scene CreateScene(string __name) => Awperative.CreateScene(__name);
/// <summary>
/// Finds a scene.
/// </summary>
/// <param name="__name">Name of the Scene</param>
/// <returns></returns>
public Scene GetScene(string __name) => Awperative.GetScene(__name);
/// <summary>
/// Destroys a Scene forever
/// </summary>
/// <param name="__scene"> Target scene</param>
public void RemoveScene(Scene __scene) => Awperative.CloseScene(__scene);
/// <summary>
/// Destroys a Scene forever
/// </summary>
/// <param name="__name">Name of the Scene</param>
public void RemoveScene(string __name) => Awperative.CloseScene(__name);
}

View File

@@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace Awperative;
namespace AwperativeKernel;
/// <summary>
/// Base class for all Awperative Entities. Responsible for Managing hierarchy between Components and Scenes, has Extensive Component Manipulation Available.

View File

@@ -5,7 +5,8 @@ using System.Linq;
using System.Reflection;
namespace Awperative;
namespace AwperativeKernel;
public static class Debug

View File

@@ -1,14 +1,10 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace Awperative;
namespace AwperativeKernel;
/// <summary>
/// Initiating class of Awperative. Call Start() to start the kernel.
@@ -24,33 +20,8 @@ public static class Awperative
/// </summary>
public static Base Base { get; internal set; }
/// <summary>
/// Handles graphics settings through MonoGame.
/// </summary>
public static GraphicsDeviceManager GraphicsDeviceManager { get; internal set; }
/// <summary>
/// Handles drawing sprites to the screen through MonoGame.
/// </summary>
public static SpriteBatch SpriteBatch { get; internal set; }
/// <summary>
/// Handles loading content through MonoGame.
/// </summary>
public static ContentManager ContentManager { get; internal set; }
/// <summary>
/// List of all scenes currently loaded in the kernel.
/// </summary>
@@ -86,7 +57,7 @@ public static class Awperative
/// <summary>
/// Returns bool based on whether there a scene with the given name or not.
/// </summary>
/// <param name="__name"></param>
/// <param name="__name"> Name of the Scene</param>
/// <returns></returns>
public static bool ContainsScene(string __name) => _scenes.Any(scene => scene.Name == __name);
@@ -95,8 +66,16 @@ public static class Awperative
/// <summary>
/// Closes a Scene
/// </summary>
/// <param name="__scene"></param>
public static void CloseScene(Scene __scene) => Scenes.Remove(GetScene(__scene.Name));
/// <param name="__scene"> Scene to close</param>
public static void CloseScene(Scene __scene) => Scenes.Remove(__scene);
/// <summary>
/// Closes a Scene
/// </summary>
/// <param name="__name"> Name of the scene</param>
public static void CloseScene(string __name) => Scenes.Remove(GetScene(__name));

View File

@@ -1,42 +1,20 @@
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.ComponentModel;
using System.Linq;
using OpenTK;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
namespace Awperative;
namespace AwperativeKernel;
/// <summary>
/// Base class of Awperative. Carries events from MonoGame into scenes and hooks.
/// </summary>
/// <author> Avery Norris </author>
public sealed class Base : Game
public sealed class Base() : GameWindow(GameWindowSettings.Default, new NativeWindowSettings() { })
{
/// <summary>
/// Start of Awperative. Please do not try to call this.
/// </summary>
internal Base() {
Awperative.GraphicsDeviceManager = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
/// <summary>
/// Initialize() is called when the program starts. Goes before LoadContent(). And prepares the kernel for use.
/// </summary>
/// <remarks> It is recommended not to load content in Initialize()</remarks>
protected override void Initialize() {
Awperative.ContentManager = Content;
Awperative.SpriteBatch = new SpriteBatch(GraphicsDevice);
base.Initialize();
}
@@ -44,7 +22,7 @@ public sealed class Base : Game
/// LoadContent() is called when the program starts; right after Initialize(). Override Load() in scripting tools or use hooks to call from this event.
/// </summary>
/// <remarks> It is recommended to load content during LoadContent()</remarks>
protected override void LoadContent() { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainLoad(); }
protected override void OnLoad() { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainLoad(); }
@@ -54,7 +32,7 @@ public sealed class Base : Game
/// Update() is called every frame; before Draw(). Override Update() in scripting tools to call from this event.
/// </summary>
/// <remarks> Hooks are unable to receive both Update() and Draw()</remarks>
protected override void Update(GameTime __gameTime) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUpdate(); base.Update(__gameTime); }
protected override void OnUpdateFrame(FrameEventArgs __args) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUpdate(); base.OnUpdateFrame(__args); }
@@ -64,7 +42,7 @@ public sealed class Base : Game
/// Draw() is called every frame; after Update(). Override Draw() in scripting tools to call from this event.
/// </summary>
/// <remarks> Hooks are unable to receive both Update() and Draw()</remarks>
protected override void Draw(GameTime __gameTime) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainDraw(); base.Draw(__gameTime); }
protected override void OnRenderFrame(FrameEventArgs __args) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainDraw(); base.OnRenderFrame(__args); }
@@ -74,7 +52,7 @@ public sealed class Base : Game
/// EndRun() is called if the program closes. Override Terminate() in scripting tools or use hooks to call from this event.
/// </summary>
/// <remarks> This event may not trigger if the program is force closed.</remarks>
protected override void EndRun() { foreach (Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUnload(); }
protected override void OnClosing(CancelEventArgs __args) { foreach (Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUnload(); base.OnClosing(__args); }

View File

@@ -1,10 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
namespace Awperative;
namespace AwperativeKernel;
public sealed partial class Scene : ComponentDocker
{