/// <summary> /// Closes the running game, if there's no game running do nothing. /// </summary> public virtual void Close() { if (Running) { // - Stop all loops InputGameLoop.Stop(); UpdateGameLoop.Stop(); GraphicGameLoop.Stop(); } }
/// <summary> /// Start the game loop, this function will block the executing /// context. /// </summary> public virtual void Run(Game game) { // - Cannot run many games at the same time if (RunningGame != null) { return; } // - Set the game RunningGame = game; // - Start update loop UpdateGameLoop.Run(); // - Start render loop GraphicGameLoop.Run(); // - Start input loop (blocking call) InputGameLoop.Run(); // - Wait for loop finish UpdateGameLoop.CurrentThread.Join(); GraphicGameLoop.CurrentThread.Join(); }