using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Awperative;
///
/// Base class of Awperative. Carries events from MonoGame into scenes and hooks.
///
/// Avery Norris
public sealed class Base : Game
{
///
/// Start of Awperative. Please do not try to call this.
///
internal Base() {
Awperative.GraphicsDeviceManager = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
///
/// Initialize() is called when the program starts. Goes before LoadContent(). And prepares the kernel for use.
///
/// It is recommended not to load content in Initialize()
protected override void Initialize() {
Awperative.ContentManager = Content;
Awperative.SpriteBatch = new SpriteBatch(GraphicsDevice);
base.Initialize();
}
///
/// LoadContent() is called when the program starts; right after Initialize(). Override Load() in scripting tools or use hooks to call from this event.
///
/// It is recommended to load content during LoadContent()
protected override void LoadContent() { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainLoad(); }
///
/// Update() is called every frame; before Draw(). Override Update() in scripting tools to call from this event.
///
/// Hooks are unable to receive both Update() and Draw()
protected override void Update(GameTime __gameTime) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUpdate(); base.Update(__gameTime); }
///
/// Draw() is called every frame; after Update(). Override Draw() in scripting tools to call from this event.
///
/// Hooks are unable to receive both Update() and Draw()
protected override void Draw(GameTime __gameTime) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainDraw(); base.Draw(__gameTime); }
///
/// EndRun() is called if the program closes. Override Terminate() in scripting tools or use hooks to call from this event.
///
/// This event may not trigger if the program is force closed.
protected override void EndRun() { foreach (Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUnload(); }
}