Files
Warhound/WarhoundConsole/Program.cs
2025-12-07 04:40:54 +09:00

62 lines
1.3 KiB
C#

using System.Diagnostics;
namespace WarhoundConsole
{
public class Program
{
public static int Main(string[] args)
{
try
{
MainInternal(args);
}
catch (Exception e)
{
Console.WriteLine(e);
return -1;
}
return 0;
}
private static void MainInternal(string[] args)
{
Singleton.I.Initialize(new());
var sw = Stopwatch.StartNew();
while (!Singleton.I.ExitRequested)
{
try
{
sw.Restart();
MainLoop();
sw.Stop();
const int targetFrameTimeMs = 10;
if (sw.Elapsed.Milliseconds < targetFrameTimeMs)
{
Thread.Sleep(targetFrameTimeMs - sw.Elapsed.Milliseconds);
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
Shutdown();
}
private static void MainLoop()
{
}
private static void Shutdown()
{
// DO SOMETHING
}
}
}