コード例 #1
0
        /// <summary>
        /// Draws the contents of the <c>Screen</c> to the screen.
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="graphics"></param>
        public override void Draw(SpriteBatch spriteBatch, GraphicsDevice graphics)
        {
            base.Draw(spriteBatch, graphics);
            graphics.Clear(spaceColor);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
                              SamplerState.PointWrap, null, null, null, null);
            ssb.Draw(spriteBatch);

            CurrentStage.Draw(spriteBatch);

            if (!isPlaying)
            {
                string  text = "PAUSED - PRESS START TO CONTINUE";
                Vector2 pos  = new Vector2(ScreenManager.GetInstance().Width / 2, ScreenManager.GetInstance().Height / 2);
                pos -= font.MeasureString(text) / 2;
                spriteBatch.DrawString(font, text, pos, Color.White);
            }

            spriteBatch.End();
        }
コード例 #2
0
        /// <summary>
        /// Draws the menu to the screen.
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="graphics"></param>
        public override void Draw(SpriteBatch spriteBatch, GraphicsDevice graphics)
        {
            base.Draw(spriteBatch, graphics);
            graphics.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
                              SamplerState.PointWrap, null, null, null, null);
            spriteBatch.Draw(logan, new Rectangle(0, 0, ScreenManager.GetInstance().Width, ScreenManager.GetInstance().Height), Color.White * 0.05f);
            bg.Draw(spriteBatch);
            Point screenDim = new Point(ScreenManager.GetInstance().Width, ScreenManager.GetInstance().Height);

            spriteBatch.Draw(titleScreen, new Rectangle(screenDim.X / 2, screenDim.Y / 2, screenDim.X, screenDim.Y), null, Color.White, 0f,
                             new Vector2(titleScreen.Width / 2f, titleScreen.Height / 2f), SpriteEffects.None, 0f);
            spriteBatch.Draw(title, new Vector2(screenDim.X - 340, 160), null, Color.White, -MathHelper.PiOver4 / 4, new Vector2(title.Width / 2f,
                                                                                                                                 title.Height / 2f), 2.5f + 0.2f * (float)Math.Sin(timer * 2), SpriteEffects.None, 0f);
            float   opacity = (float)Math.Cos(timer * 4) * 0.6f + 0.65f;
            string  text    = "Press the A button to continue";
            Vector2 origin  = font.MeasureString(text) / 2;

            spriteBatch.DrawString(font, text, new Vector2(ScreenManager.GetInstance().Width / 2,
                                                           ScreenManager.GetInstance().Height / 2 + 300), Color.White * opacity, 0f, origin, 1f, SpriteEffects.None, 0f);
            spriteBatch.End();
        }