/// <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) { #if !NETFX_CORE if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } #endif EdgeType SlowLatchEvent = SlowLatch.ProcessValue(GameTime.IsRunningSlowly); if (SlowLatchEvent == EdgeType.RisingEdge) { Log.Warn("Game running slowly! Time since last update: " + GameTime.ElapsedGameTime); } else if (SlowLatchEvent == EdgeType.FallingEdge) { Log.Info("Game no longer running slowly."); } SceneManager.Update(GameTime); ArcadeFrame.Update(GameTime); base.Update(GameTime); }
public void Update(GameTime Time, bool NewValue) { EdgeType Edge = StateLatch.ProcessValue(NewValue); if (Edge != EdgeType.None) { PreviousActiveEdge = Edge; StartTime = Time.TotalGameTime.TotalSeconds; } double NewCompletionPct = MathUtils.Clamp((Time.TotalGameTime.TotalSeconds - StartTime) / AnimationDuration, 0, 1); switch (PreviousActiveEdge) { case EdgeType.RisingEdge: CurrentValue = PositiveEasingFunction(NewCompletionPct); break; case EdgeType.FallingEdge: CurrentValue = NegativeEasingFunction(NewCompletionPct); break; } }