From 61d43ef61ebf94b1495ee61b2c23538bb618e06a Mon Sep 17 00:00:00 2001 From: tymmkang Date: Sun, 7 Dec 2025 04:38:51 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EB=A3=A8=ED=94=84=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarhoundConsole/Program.cs | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/WarhoundConsole/Program.cs b/WarhoundConsole/Program.cs index 8acf212..d436ff9 100644 --- a/WarhoundConsole/Program.cs +++ b/WarhoundConsole/Program.cs @@ -1,4 +1,6 @@  +using System.Diagnostics; + namespace WarhoundConsole { public class Program @@ -22,15 +24,38 @@ namespace WarhoundConsole { Singleton.I.Initialize(new()); - bool exitRequested = Singleton.I.ExitRequested; - while (!exitRequested) + var sw = Stopwatch.StartNew(); + while (!Singleton.I.ExitRequested) { + try + { + sw.Restart(); + MainLoop(); + sw.Stop(); - - exitRequested = Singleton.I.ExitRequested; + const int targetFrameTimeMs = 10; + if (sw.Elapsed.Milliseconds < targetFrameTimeMs) + { + Thread.Sleep(targetFrameTimeMs - sw.Elapsed.Milliseconds); + } + } + catch (Exception e) + { + Console.WriteLine(e); + } } - // Graceful shutdown + Shutdown(); + } + + private static void MainLoop() + { + + } + + private static void Shutdown() + { + // DO SOMETHING } } }