Editor dummy code
This commit is contained in:
@ -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 class Engine
|
||||
|
||||
AudioDevice = new AudioDevice();
|
||||
|
||||
OnInitialize?.Invoke();
|
||||
|
||||
while (!quit)
|
||||
{
|
||||
Tick();
|
||||
}
|
||||
|
||||
OnQuit?.Invoke();
|
||||
|
||||
GraphicsDevice.UnclaimWindow(MainWindow);
|
||||
MainWindow.Dispose();
|
||||
GraphicsDevice.Dispose();
|
||||
@ -146,6 +155,7 @@ public static class Engine
|
||||
ProcessSDLEvents();
|
||||
|
||||
// Tick game here...
|
||||
OnUpdate?.Invoke();
|
||||
|
||||
AudioDevice.WakeThread();
|
||||
accumulatedUpdateTime -= Timestep;
|
||||
@ -154,6 +164,7 @@ public static class Engine
|
||||
double alpha = accumulatedUpdateTime / Timestep;
|
||||
|
||||
// Render here..
|
||||
OnRender?.Invoke();
|
||||
|
||||
accumulatedDrawTime -= framerateCapTimeSpan;
|
||||
}
|
||||
|
Reference in New Issue
Block a user