/// <summary> /// Zaktualizuj rozmiary i po³o¿enie wszystkich komponentów w zale¿noœci od zmieniaj¹cego siê rozmiaru okna. /// </summary> /// <param name="gameTime">czas trwania gry</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { Exit(); } UpdateBackground(Window.ClientBounds.Width, Window.ClientBounds.Height); if (ScreenType != ScreenType.Login && _mainMenu == null) { LoadRestSreens(); } if (Utils.User != null && Utils.User.IsMusic == false) { if (MediaPlayer.State != MediaState.Paused) { MediaPlayer.Pause(); } } else { if (MediaPlayer.State != MediaState.Playing) { MediaPlayer.Play(_song); } } switch (ScreenType) { case ScreenType.MainMenu: _mainMenu.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; case ScreenType.Settings: _settings.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; case ScreenType.Help: _help.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; case ScreenType.HighScores: _highScores.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; case ScreenType.Game: _game.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; case ScreenType.LoadGame: _loadGame.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; case ScreenType.Login: _login.Update(gameTime, Window.ClientBounds.Width, Window.ClientBounds.Height); break; } base.Update(gameTime); }