예제 #1
0
파일: Main.cs 프로젝트: YorickBM/NonFlash
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GameScreenManager.Instance.Quit || GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || InputManager.Instance.KeyPressed(Keys.Escape))
            {
                RetroEnvironment.CompleteShutdown();
                Exit();
            }

            MonoGame_Textbox.KeyboardInput.Update();

            if (resizing.Pending)
            {
                Console.WriteLine("Resizing");
                graphics.PreferredBackBufferWidth  = resizing.Width;
                graphics.PreferredBackBufferHeight = resizing.Height;
                graphics.ApplyChanges();
                //camera.UpdateProjection(resizing.Width, resizing.Height);
                GameScreenManager.Instance.Dimensions.X = resizing.Width;
                GameScreenManager.Instance.Dimensions.Y = resizing.Height;
                resizing.Pending = false; // Resize is complete (no longer pending)
            }

            GameScreenManager.Instance.Update(gameTime);
            base.Update(gameTime);
        }
예제 #2
0
        static void Main()
        {
            int trys = 0;

            try
            {
                using (var game = new Main())
                {
                    try
                    {
                        game.Run();
                    }catch (InvalidOperationException ex)
                    {
                        if (trys++ < 5)
                        {
                            game.Run();
                        }
                    }
                }
            }catch (Exception ex)
            {
                Console.WriteLine("CRASH");
                Console.WriteLine(ex.ToString());

                Console.ReadLine();
            }


            RetroEnvironment.CompleteShutdown();
        }