using System.ComponentModel;
using System.Linq;
using OpenTK;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
namespace AwperativeKernel;
///
/// Base class of Awperative. Carries events from MonoGame into scenes and hooks.
///
/// Avery Norris
public sealed class Base() : GameWindow(GameWindowSettings.Default, new NativeWindowSettings() { })
{
///
/// 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 OnLoad() { 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 OnUpdateFrame(FrameEventArgs __args) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUpdate(); base.OnUpdateFrame(__args); }
///
/// 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 OnRenderFrame(FrameEventArgs __args) { foreach(Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainDraw(); base.OnRenderFrame(__args); }
///
/// 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 OnClosing(CancelEventArgs __args) { foreach (Scene scene in Awperative.Scenes.ToList()) if(scene.Enabled) scene.ChainUnload(); base.OnClosing(__args); }
}