コード例 #1
0
ファイル: Game.cs プロジェクト: save-buffer/ShooterGame
            new public void Update()
            {
                Application.DoEvents();
                base.Update();
                if (FrameRateController.ProceedToNextFrame)    //If we can move onto the next frame
                {
                    for (int i = 0; i < KeyBuffer.Length; i++) //Copy the asynchronous buffer into the synchronous one
                    {
                        KeysCurrentFrame[i] = KeyBuffer[i];
                    }
                    this.Invalidate(); //Invalidate the current image. This calls the Game_Paint event
                    if (CurrentState != null)
                    {
                        CurrentState.Update();                      //Update the current GameState
                    }
                    FrameRateController.ProceedToNextFrame = false; //Notify the FramerateController that the frame has been executed

                    for (int i = 0; i < KeysLastFrame.Length; i++)  //Copy the synchronous buffer into the previous frame buffer
                    {
                        KeysLastFrame[i] = KeysCurrentFrame[i];
                    }
                }
            }
コード例 #2
0
ファイル: TPEngine.cs プロジェクト: rafiqd/NetworkDefense
 public void Update(GameTime gameTime)
 {
     State.Update(gameTime);
     Input.Update(gameTime);
 }