Esempio n. 1
0
        /// <summary>
        /// This is called when the screen should draw itself.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to Draw.</param>
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (_contentFinishedLoading)
            {
                this.ScreenManager.GraphicsDevice.Clear(Color.CornflowerBlue);

                _breakroom.Draw(gameTime, _spriteBatch);

                _miniGameTimer.Draw(ScreenManager.SpriteBatch);
            }

            base.Draw(gameTime);
        }
Esempio n. 2
0
        /// <summary>
        /// This is called when the screen should draw itself.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to Draw.</param>
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Draw(gameTime);

            _quizTimer.Draw(ScreenManager.SpriteBatch);

            // make sure our entries are in the right place before we draw them
            this.UpdateMenuEntryLocations();

            GraphicsDevice graphics    = this.ScreenManager.GraphicsDevice;
            SpriteBatch    spriteBatch = this.ScreenManager.SpriteBatch;
            SpriteFont     font        = this.ScreenManager.Font;

            spriteBatch.Begin();

            // Draw each menu entry in turn.
            for (int i = 0; i < this._menuEntries.Count; i++)
            {
                AnswerEntry menuEntry = this._menuEntries[i];

                bool isSelected = this.IsActive && (i == this._selectedEntry);

                menuEntry.Draw(this, isSelected, gameTime);
            }

            // Make the menu slide into place during transitions, using a
            // power curve to make things look more interesting (this makes
            // the movement slow down as it nears the end).
            float transitionOffset = (float)Math.Pow(this.TransitionPosition, 2);

            // Draw the menu title centered on the screen
            Vector2 titlePosition = new Vector2(graphics.Viewport.Width / 2, 120);
            Vector2 titleOrigin   = font.MeasureString(this._currentQuestion.QuestionText) / 2;
            Color   titleColor    = new Color(192, 192, 192) * this.TransitionAlpha;
            float   titleScale    = 1.25f;

            titlePosition.Y -= transitionOffset * 100;

            spriteBatch.DrawString(font, this._currentQuestion.QuestionText, titlePosition, titleColor, 0,
                                   titleOrigin, titleScale, SpriteEffects.None, 0);

            spriteBatch.End();
        }