private void Update() { // update fps, the unscaledDeltaTime is used m_fps.Update(Time.deltaTime, Time.unscaledDeltaTime); // check resolution change if (m_resolution.x != Screen.width || m_resolution.y != Screen.height) { m_uiAdaptiveScale = (Screen.width / 960.0f); m_resolution.x = Screen.width; m_resolution.y = Screen.height; } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { //Update fps measurer Fps.Update(gameTime); GraphicsDevice.Clear(BackgroundColor); _spriteBatch.Begin(SpriteSortMode.Deferred, null); if (ScriptExecuter.IsInPlayingMovie)//Movie { ScriptExecuter.DrawVideo(_spriteBatch); } else { switch (GameState.State) { case GameState.StateType.Start: break; case GameState.StateType.Title: break; case GameState.StateType.Playing: DrawGamePlay(gameTime); if (Globals.ShowMapPos || Globals.ScriptShowMapPos) { DrawMapPos(_spriteBatch); } break; case GameState.StateType.EndAds: DrawAds(gameTime); break; default: throw new ArgumentOutOfRangeException(); } //GUI GuiManager.Draw(_spriteBatch); } if (IsInEditMode) { DrawGameInfo(_spriteBatch); } _spriteBatch.End(); base.Draw(gameTime); }