Esempio n. 1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);



            spriteBatch.Begin();
            // Draw game and menu
            game.Draw(spriteBatch);
            menu.Draw(spriteBatch);

            // Draw speed text specifically by converting the float to an int with a 10% safety marginal and then converting it back to float and divide it by 10, creating a clean, one decimal, float (visually).
            menu.Pages[3].Buttons[1].Text[0] = "Speed: " + (float)(int)(options.Speed * 10.1f) / 10;

            // If play screen
            if (menu.PageSelection == 1)
            {
                // Look if mouse intersects pause button, if it does, change color from gray to white
                if (input.MousePointer.Intersects(pauseButton))
                {
                    spriteBatch.Draw(pauseButtonTexture, pauseButton = new Rectangle(0, 0, pauseButtonTexture.Width, pauseButtonTexture.Height), Color.White);
                }
                else
                {
                    spriteBatch.Draw(pauseButtonTexture, pauseButton = new Rectangle(0, 0, pauseButtonTexture.Width, pauseButtonTexture.Height), Color.Gray);
                }
            }

            // If highscore page, draw the highscore list
            if (menu.PageSelection == 2)
            {
                saveFile.Draw(spriteBatch, scoreBoardFont);
            }


            // If mouse moves, make it 100% visible and reset timer to 2 seconds
            if (input.MousePointer != input.PreviousMousePosition)
            {
                mouseVisibility = 1f;
                mouseTimer      = 2000;
            }
            // If mouse does not move, make the 2 second timer count downwards, until it reaches zero, that's when mouse visibility gets reduced by 16% every game tick
            else
            {
                mouseTimer -= (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                if (mouseTimer < 0)
                {
                    mouseVisibility /= 1.16f;
                }
            }
            // Draw the mouse with it's visibility (on top of everything else)
            input.DrawMouse(spriteBatch, mouseTexture, mouseVisibility);

            spriteBatch.End();

            base.Draw(gameTime);
        }
Esempio n. 2
0
    public static void Draw(AD2SpriteBatch sb)
    {
        switch (GState)
        {
        case State.Title:
            Title.Draw(sb);
            break;

        case State.CharSelect:
            CharSelect.Draw(sb);
            break;

        case State.InGame:
            InGame.Draw(sb);
            break;
        }

        //Utils.DefaultFont.Draw(sb, LastDelta.IsRunningSlowly ? "SLOW!" : "", 100, 1, Color.BlanchedAlmond, 1, true);
    }