/// <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) { //timer for measuring performance & implementing the clocks updateLoopTimer.Start(); if (IsActive) { //start perfMeasureSW to measure performance of the intrpreter step method perfMeasureSW.Start(); //step the intrpreter intr.Advance(); perfMeasureSW.Stop(); Debug.WriteLine($"Interpreter advance execution time {perfMeasureSW.ElapsedMilliseconds}ms"); perfMeasureSW.Reset(); //check for any keys being pressed CheckForKeyPress(); //if the drawglag is set, if (intr.drawFlag) { perfMeasureSW.Start(); DrawTextureArray(); } //If user presses Esc, exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown( Keys.Escape)) { Exit(); } //measure amt of time taken by base.Update perfMeasureSW.Start(); base.Update(gameTime); perfMeasureSW.Stop(); Debug.WriteLine($"base.Update(gametime) took {perfMeasureSW.ElapsedMilliseconds} ms"); perfMeasureSW.Reset(); } }