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;
///
/// Initiating class of Awperative. Call Start() to start the kernel.
///
/// Avery Norris
public static class Awperative
{
///
/// Bottom class of Awperative. Contains the MonoGame instance.
///
public static Base Base { get; internal set; }
///
/// Handles graphics settings through MonoGame.
///
public static GraphicsDeviceManager GraphicsDeviceManager { get; internal set; }
///
/// Handles drawing sprites to the screen through MonoGame.
///
public static SpriteBatch SpriteBatch { get; internal set; }
///
/// Handles loading content through MonoGame.
///
public static ContentManager ContentManager { get; internal set; }
///
/// List of all scenes currently loaded in the kernel.
///
public static ImmutableArray Scenes => [.._scenes];
internal static HashSet _scenes { get; private set; } = [];
///
/// Creates a new Scene
///
public static void Create(string __name) { if (Contains(__name)) _scenes.Add(new Scene(__name)); else Debug.LogError("Awperative already has a Scene with that name!", ["Scene", "Name"], [Get(__name).GetHashCode().ToString(), __name]); }
///
/// Finds a Scene from a given name
///
/// Name to search for
///
public static Scene Get(string __name) => _scenes.FirstOrDefault(scene => scene.Name == __name, null);
///
/// Returns bool based on whether there a scene with the given name or not.
///
///
///
public static bool Contains(string __name) => _scenes.Any(scene => scene.Name == __name);
///
/// Closes a Scene
///
///
public static void Close(Scene __scene) => Scenes.Remove(Get(__scene.Name));
///
/// Start() begins the game; and begins communication with all event hooks.
///
/// 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() {
Base = new Base();
Base.Run();
}
}