Пример #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)
        {
            //Define options to draw on the sprite
            GraphicsDevice.BlendState        = BlendState.Opaque;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.Clear(Color.LightSkyBlue);

            //Define the start of the draw on the sprite with a specific order
            SpriteBatch.Begin(SpriteSortMode.BackToFront, null);
            //If not launched we draw the start HUD
            if (!_launched && !_manager.Ended)
            {
                SpriteBatch.Draw(_background, new Rectangle(0, 0, Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0.0f);
                SpriteBatch.End();
                SpriteBatch.Begin();
                _ui.Draw(gameTime);
            }
            //If launched we draw the HUD, the charge bar and the game
            else
            {
                DrawHud();
                base.Draw(gameTime);
                _chargeBar.Draw(gameTime);
            }
            //If the game is finished we draw the score board
            if (_manager.Ended)
            {
                _sound.Clap();
                _launched      = false;
                IsMouseVisible = true;
                _ui.Draw(gameTime);
                _sound.StopAmbiant();
            }
            SpriteBatch.End();
        }
Пример #2
0
 public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     _ui.Draw(gameTime);
     spriteBatch.DrawString(font, ((int)Math.Ceiling(1000 / (float)gameTime.ElapsedGameTime.TotalMilliseconds)).ToString(), FPS, Color.White);
     spriteBatch.DrawString(font, ((int)Math.Ceiling(1000 / (float)gameTime.ElapsedGameTime.TotalMilliseconds)).ToString(), Text, Color.White);
 }