internal override void Run() { Debug.Assert(InitCallback != null); Debug.Assert(RunCallback != null); // Initialize the init callback InitCallback(); if (GameContext.IsUserManagingRun) { GameContext.RunCallback = RunCallback; GameContext.ExitCallback = ExitCallback; } else { var runCallback = new WindowsMessageLoop.RenderCallback(RunCallback); // Run the rendering loop try { WindowsMessageLoop.Run(Control, () => { if (Exiting) { if (Control != null) { Control.Dispose(); Control = null; } return; } runCallback(); }); } finally { if (ExitCallback != null) { ExitCallback(); } } } }
internal override void Run() { Debug.Assert(InitCallback != null); Debug.Assert(RunCallback != null); // Initialize the init callback InitCallback(); Debug.Assert(GameContext is GameContextWinforms, "There is only one possible descendant of GameContext<Control>."); var context = (GameContextWinforms)GameContext; if (context.IsUserManagingRun) { context.RunCallback = RunCallback; context.ExitCallback = ExitCallback; } else { var runCallback = new WindowsMessageLoop.RenderCallback(RunCallback); // Run the rendering loop try { WindowsMessageLoop.Run(Control, () => { if (Exiting) { Destroy(); return; } runCallback(); }); } finally { if (ExitCallback != null) { ExitCallback(); } } } }
internal override void Run() { Debug.Assert(InitCallback != null); Debug.Assert(RunCallback != null); // Initialize the init callback InitCallback(); if (GameContext.IsUserManagingRun) { GameContext.RunCallback = RunCallback; GameContext.ExitCallback = ExitCallback; } else { var runCallback = new WindowsMessageLoop.RenderCallback(RunCallback); // Run the rendering loop try { WindowsMessageLoop.Run(Control, () => { if (Exiting) { if (Control != null) { Control.Dispose(); Control = null; } return; } runCallback(); }); } finally { if (ExitCallback != null) { ExitCallback(); } } } }