Ejemplo n.º 1
0
        //draws menu items
        public void Draw(GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            graphics.Clear(Color.Black);
            List<Button> buttonstemp = new List<Button>();
            spriteBatch.Begin();
            Vector2 location = position;
            for (int i = 0; i < menuItems.Length; i++)
            {
                Vector2 stringSize = spriteFont.MeasureString(menuItems[i]);
                int width = Convert.ToInt32(stringSize.X + 200);
                int height = Convert.ToInt32(stringSize.Y + 50);
                Button button = new Button("pixel", location, new Rectangle(0, 0, width, height));
                buttonstemp.Add(button);

                button.Draw(spriteBatch);

                spriteBatch.DrawString(
                spriteFont,
                menuItems[i],
                location,
                fontColor);
                location.Y += spriteFont.LineSpacing + 55;
            }
            spriteBatch.End();
            buttons = buttonstemp;
        }
Ejemplo n.º 2
0
        public Player(List<Character> characters)
            : base()
        {
            this.characters = characters;
            sprite = new Sprite("egg");
            sprite.Scale = 0.3f;
            sprite.iColor.SetColor(Color.White);
            speed = 300;
            position = new Vector2(100, 300);

            btnRight = new Button("pixel", new Vector2(250, 420), new Rectangle(0, 0, 150, 100));
            btnLeft = new Button("pixel", new Vector2(90, 420), new Rectangle(0, 0, 150, 100));
            btnJump = new Button("pixel", new Vector2(710, 420), new Rectangle(0, 0, 150, 100));

            btnPause = new Button("pixel", new Vector2(710, 50), new Rectangle(0, 0, 100, 100));

            weight = 9f;
        }
Ejemplo n.º 3
0
 public SettingsMenu(Game game)
     : base(game)
 {
     btnBack = new Button("pixel", new Vector2(710, 420), new Rectangle(0, 0, 150, 100));
 }
Ejemplo n.º 4
0
 public HighScores(Game game)
     : base(game)
 {
     btnBack = new Button("pixel", new Vector2(710, 420), new Rectangle(0, 0, 150, 100));
 }
Ejemplo n.º 5
0
 public PauseMenu(Game game)
     : base(game)
 {
     btnBack = new Button("pixel", new Vector2(710, 420), new Rectangle(0, 0, 150, 100));
     btnResume = new Button("pixel", new Vector2(710, 300), new Rectangle(0, 0, 150, 100));
 }