Ejemplo n.º 1
0
        /// <summary>
        /// Main Game timer for  "real time"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer_Tick(object sender, EventArgs e)
        {
            if (game.Status == PongGame.GameStatus.Running)
            {
                game.Update();
                gameRenderer.Invalidate();
            }
            else
            {
                timer.Stop();
                if (!msg)
                {
                    switch (game.Status)
                    {
                    case PongGame.GameStatus.Won:
                        MessageBox.Show("You won!");
                        break;

                    case PongGame.GameStatus.Lose:
                        MessageBox.Show("You lose!");
                        break;

                    default:
                        break;
                    }

                    msg = true;
                }
            }
        }
Ejemplo n.º 2
0
 private void OnPostRender(object sender, EventArgs e)
 {
     game.Update();
     game.Draw(Game1.spriteBatch);
 }