예제 #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            for (int i = this.numberOfRecordedStates-1; i > 0; i--)
            {
                TetrisGame.keyboardStates[i] = TetrisGame.keyboardStates[i - 1];
            }
            TetrisGame.keyboardStates[0]=Keyboard.GetState();
            if(this.gameLogic == null)
            {
                this.gameLogic = new GameLogic(gameTime,this);
            }
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            float time = gameTime.ElapsedGameTime.Milliseconds/1000.0f;
              //  Console.WriteLine("iteration : " + this.updateNumber);
              //  Console.WriteLine("time ellapsed since last iteration : " +time);
              //  Console.WriteLine("updating game...");
            gameLogic.updateGame(gameTime);
            this.updateNumber++;
            rotation = rotation + 0.005f;

               // Console.WriteLine("");
               // Console.WriteLine("");
              //  rootObject.UpdateLogicGame(time);
              //  move = Matrix.CreateTranslation(new Vector3(1f * time, 0, 1f * time)) *move ;
            base.Update(gameTime);
        }
예제 #2
0
 public void newGame()
 {
     this.gameLogic = null;
 }