Esempio n. 1
0
        /// <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)
        {
            GraphicsDevice.Clear(Color.Black);
            mRefreshTimer += (float)_gameTime.ElapsedGameTime.TotalMilliseconds;

            // Check if a 2D camera exists, configure spritebatch accordingly
            if (mCamera != null)
            {
                mSpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend,
                                   null, null, null, null, mCamera.GetTransform(GraphicsDevice));
            }
            else
            {
                mSpriteBatch.Begin();
            }

            mBackgroundManager.Draw(mSpriteBatch, _gameTime);

            if (mRefreshTimer >= mRefreshRate)
            {
                mSceneManager.Draw(mSpriteBatch, _gameTime);
                if (Global.GameState == Global.availGameStates.Menu)
                {
                    mMenuManager.Draw(mSpriteBatch);
                }
                // TODO: Add your drawing code here
                mRefreshTimer = 0f;
            }
            mSpriteBatch.End();
            base.Draw(_gameTime);
        }