Esempio n. 1
0
        }                                          //Toggles the cursor that is under the current index selection.

        /// <summary>
        /// Draws the sprites contained in the GUI, if there is a selection grid, it will also be drawn.
        /// The index can be used to determine which selection is currently being pointed at.
        /// </summary>
        /// <param name="sb">Standard Sprite batch</param>
        /// <param name="scale">Used for scaleing, currently unused</param>
        public void draw(SpriteBatchPlus sb, float scale)
        {
            foreach (GSprite s in _sprites)
            {
                s.draw(sb, scale);
            }

            //If no menu options are present, this is skipped
            if (_menuOptions != null)
            {
                foreach (MenuOption mo in _menuOptions)
                {
                    mo.draw(sb, scale);
                }
            }

            //Draws a sector underneath the current index in the gui
            if (sel)
            {
                Rectangle line = new Rectangle(_menuOptions[_index].getRegion().X,
                                               _menuOptions[_index].getRegion().Y + _menuOptions[_index].getRegion().Height,
                                               _menuOptions[_index].getRegion().Width,
                                               5);
                sb.Draw(sb.defaultTexture(), line, _color);
            }
        }
Esempio n. 2
0
        public void draw(SpriteBatchPlus sb, float scale)
        {
            _hudBG.draw(sb, scale);

            // Draws health bar
            _healthBorder.draw(sb, scale);
            sb.Draw(sb.defaultTexture(),
                    new Rectangle((int)_hudBG.getPosition().X + 80, (int)_hudBG.getPosition().Y + 16, (int)(CurrentHP * ((hpBarLength / MaxHP))), 11),
                    Color.LawnGreen);

            sb.DrawString(font, "Health: ",
                          new Vector2(_hudBG.getPosition().X + xOffset, _hudBG.getPosition().Y + yOffset),
                          Color.White);
            String health = CurrentHP + " / " + MaxHP;

            sb.DrawString(font, health,
                          new Vector2(_healthBorder.getPosition().X + _healthBorder.getRect().Width / 2 - font.MeasureString(health).X / 2,
                                      _healthBorder.getPosition().Y + _healthBorder.getRect().Height / 2 - font.MeasureString(health).Y / 2),
                          new Color(Color.Black, 0.4f));
            sb.DrawString(font, "Score: " + Score,
                          new Vector2(_hudBG.getPosition().X + xOffset, _hudBG.getPosition().Y + yOffset + _fheight),
                          Color.White);
            sb.DrawString(font, "Currency: " + Currency,
                          new Vector2(_hudBG.getPosition().X + xOffset, _hudBG.getPosition().Y + yOffset + _fheight * 2),
                          Color.White);
            sb.DrawString(font, "Level: " + Level,
                          new Vector2(_hudBG.getPosition().X + xOffset, _hudBG.getPosition().Y + yOffset + _fheight * 3),
                          Color.White);
        }
Esempio n. 3
0
        //private Texture2D _t;

        override public void draw(SpriteBatchPlus sb, float scale)
        {
            sb.Draw(sb.defaultTexture(), _r, _c);
        }