示例#1
0
        public void Draw(SpriteBatch spriteBatch, GraphicsDeviceManager graphics, GameTime gameTime, FontLoader fontLoader)
        {
            if (gameTime.TotalGameTime.TotalMilliseconds <= LoadingTime + TimeBeforeUserCanContinue)
            {
                loading.Draw(graphics, spriteBatch);
            }

            else if (!(timePressed.TotalMilliseconds < DummyTimeSpan.TotalMilliseconds) && !isGoingToMenu)
            {
                spriteBatch.Begin();

                //if (!didClick) { Game1.PlaySound("back"); didClick = true; }
                string     output = "Press Any Key";
                SpriteFont font   = fontLoader.GetFont("OpenSans", false, 14);
                spriteBatch.DrawString(font, output, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight * 40 / 55), Color.White, 0, font.MeasureString(output) / 2, 1.2f * ((ResOffset.X + ResOffset.Y) / 2), SpriteEffects.None, 0);

                blackTex.SetData(new Color[] { new Color(0, 0, 0, PressAlpha) });
                spriteBatch.Draw(blackTex, new Rectangle(0, 0, 1000000, 20000000), Color.Black);
                spriteBatch.Draw(Title, new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight * 9 / 10) / 2, null, Color.White, 0, new Vector2(650, 332) / 2, 1.3f * ((ResOffset.X + ResOffset.Y) / 2), SpriteEffects.None, 0);

                spriteBatch.End();
            }

            if (isGoingToMenu)
            {
                spriteBatch.Begin();
                if (logoAnimation.TotalMilliseconds >= timeBeforeMoving)
                {
                    logoAnim.Update(gameTime.ElapsedGameTime);
                }

                spriteBatch.Draw(logo, logoAnim.GetV2(0), null, Color.White * MathHelper.Clamp((float)logoAnimation.TotalMilliseconds / logoFadeInTime, 0, 1), 0, logoOrigin, logoAnim.GetV2(1), SpriteEffects.None, 0);
                spriteBatch.End();
            }

            graphics.GraphicsDevice.BlendState        = BlendState.Opaque;
            graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        }
示例#2
0
        public void Draw(SpriteBatch sb, GraphicsDevice device)
        {
            sb.Begin();
            //sb.Draw(back, new Rectangle(0, 0, screen.Width, screen.Height), null, Color.White * backGroundAlphaAnimation.Resize.X, 0, Vector2.Zero, SpriteEffects.None, 1);
            sb.Draw(back, new Rectangle(0, 0, screen.Width / 2, screen.Height / 2), null, Color.White * backGroundAlphaAnimation.GetV2(0).X * 0.35f, 0, Vector2.Zero, SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically, 1);
            sb.Draw(back, new Rectangle(screen.Width / 2, 0, screen.Width / 2, screen.Height / 2), null, Color.White * backGroundAlphaAnimation.GetV2(0).X * 0.35f, 0, Vector2.Zero, SpriteEffects.FlipVertically, 1);
            sb.Draw(back, new Rectangle(0, screen.Height / 2, screen.Width / 2, screen.Height / 2), null, Color.White * backGroundAlphaAnimation.GetV2(0).X * 0.35f, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 1);
            sb.Draw(back, new Rectangle(screen.Width / 2, screen.Height / 2, screen.Width / 2, screen.Height / 2), null, Color.White * backGroundAlphaAnimation.GetV2(0).X * 0.35f, 0, Vector2.Zero, SpriteEffects.None, 1);

            sb.Draw(logo, new Vector2(TitleScreenClass.endLogoPositionSize.X, TitleScreenClass.endLogoPositionSize.Y), null, Color.White, 0, TitleScreenClass.logoOrigin, new Vector2(TitleScreenClass.endLogoPositionSize.Z, TitleScreenClass.endLogoPositionSize.W), SpriteEffects.None, 0);


            switch (selected)
            {
            case 1: sb.Draw(_1, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0); break;

            case 2: sb.Draw(_2, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0); break;

            case 3: sb.Draw(_3, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0); break;

            case 4: sb.Draw(_4, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0); break;

            case 5: sb.Draw(_5, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0); break;
            }

            if (!isMainMenu)
            {
                sb.Draw(textEsc, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0);
            }
            else
            {
                sb.Draw(showNewGame ? textNewGame : textContinue, new Vector2(screen.Width, screen.Height) / 2, null, Color.White * backGroundAlphaAnimation.GetV2(0).X, 0, new Vector2(1920, 1080), menuScale * resOffset, SpriteEffects.None, 0);
            }



            sb.End();
        }