Пример #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
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            switch (CurrentGameState)
            {
            case GameState.EscMenu:
            case GameState.Menu: menu.Draw(spriteBatch, GraphicsDevice);
                break;

            case GameState.Playing: playing.Draw(spriteBatch, fontLoader, graphics, gameTime);
                break;

            case GameState.Loading: loading.Draw(graphics, spriteBatch);
                break;

            case GameState.TitleScreen: titleScreen.Draw(spriteBatch, graphics, gameTime, fontLoader);
                break;
            }


            base.Draw(gameTime);
        }