diff --git a/Nerfed.Editor/Editor/EditorGui.cs b/Nerfed.Editor/Editor/EditorGui.cs
new file mode 100644
index 0000000..8a9f6a9
--- /dev/null
+++ b/Nerfed.Editor/Editor/EditorGui.cs
@@ -0,0 +1,30 @@
+namespace Nerfed.Editor.Editor
+{
+ internal static class EditorGui
+ {
+ internal static void Initialize()
+ {
+ // Create GuiController.
+
+ // Subscribe to GUI update.
+ // GuiController.OnGui call => UpdateDock;
+ // GuiController.OnGui call => UpdateEditorWindows;
+ // GuiController.OnGui call => ...;
+ }
+
+ internal static void Update()
+ {
+ // Update GuiController.
+ }
+
+ internal static void Render()
+ {
+ // Reneder GuiController.
+ }
+
+ private static void UpdateDock()
+ {
+ // Setup default dockspace for the main window.
+ }
+ }
+}
\ No newline at end of file
diff --git a/Nerfed.Editor/Nerfed.Editor.csproj b/Nerfed.Editor/Nerfed.Editor.csproj
index cfa3c24..8aec954 100644
--- a/Nerfed.Editor/Nerfed.Editor.csproj
+++ b/Nerfed.Editor/Nerfed.Editor.csproj
@@ -23,8 +23,8 @@
-
+
-
+
diff --git a/Nerfed.Editor/Program.cs b/Nerfed.Editor/Program.cs
index 7c4737d..92bbbc8 100644
--- a/Nerfed.Editor/Program.cs
+++ b/Nerfed.Editor/Program.cs
@@ -6,6 +6,33 @@ internal class Program
{
private static void Main(string[] args)
{
+ Engine.OnInitialize += HandleOnInitialize;
+ Engine.OnUpdate += HandleOnUpdate;
+ Engine.OnRender += HandleOnRender;
+ Engine.OnQuit += HandleOnQuit;
+
Engine.Run(args);
}
-}
+
+ private static void HandleOnInitialize()
+ {
+ // Open project.
+ // Setip EditorGui.
+ }
+
+ private static void HandleOnUpdate()
+ {
+ // Editor Update.
+
+ // Try Catch UserCode Update.
+ }
+
+ private static void HandleOnRender()
+ {
+ // Editor GUI Render.
+ }
+
+ private static void HandleOnQuit()
+ {
+ }
+}
\ No newline at end of file
diff --git a/Nerfed.Runtime/Engine.cs b/Nerfed.Runtime/Engine.cs
index 8d951eb..7dd741e 100644
--- a/Nerfed.Runtime/Engine.cs
+++ b/Nerfed.Runtime/Engine.cs
@@ -1,12 +1,17 @@
-using System.Diagnostics;
using Nerfed.Runtime.Audio;
using Nerfed.Runtime.Graphics;
using SDL2;
+using System.Diagnostics;
namespace Nerfed.Runtime;
public static class Engine
{
+ public static event Action OnInitialize;
+ public static event Action OnUpdate;
+ public static event Action OnRender;
+ public static event Action OnQuit;
+
public static TimeSpan MaxDeltaTime { get; set; } = TimeSpan.FromMilliseconds(100);
public static bool VSync { get; set; }
@@ -65,11 +70,15 @@ public static void Run(string[] args)
AudioDevice = new AudioDevice();
+ OnInitialize?.Invoke();
+
while (!quit)
{
Tick();
}
+ OnQuit?.Invoke();
+
GraphicsDevice.UnclaimWindow(MainWindow);
MainWindow.Dispose();
GraphicsDevice.Dispose();
@@ -146,6 +155,7 @@ private static void Tick()
ProcessSDLEvents();
// Tick game here...
+ OnUpdate?.Invoke();
AudioDevice.WakeThread();
accumulatedUpdateTime -= Timestep;
@@ -154,6 +164,7 @@ private static void Tick()
double alpha = accumulatedUpdateTime / Timestep;
// Render here..
+ OnRender?.Invoke();
accumulatedDrawTime -= framerateCapTimeSpan;
}