예제 #1
0
파일: Runtime.cs 프로젝트: piRepos/pEngine
 /// <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();
     }
 }
예제 #2
0
파일: Runtime.cs 프로젝트: piRepos/pEngine
        /// <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();
        }