Esempio n. 1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Rectangle sourceRect    = selected ? SelectedSourceRect() : UnselectedSourceRect();
            Color     _color        = enabled ? color : CustomColors.darkerGray;
            float     _transparency = transparency;

            if (selectionColor > 0)
            {
                selectionColor--;
                _color        = Color.White;
                _transparency = 0.3f;
            }

            spriteBatch.Draw(texture, BoundingRect(), sourceRect, _color * _transparency, 0, new Vector2(0, 0), SpriteEffects.None, 0);

            Vector2 sizeOfLabel = HelperFunctions.SizeOfString(buttonTextLabel.GetFont(), buttonTextLabel.text);

            if (buttonTextLabel.text != "")
            {
                buttonTextLabel.centerPosition = new Vector2(position.X + sizeOfLabel.X / 2 + widthPadding, position.Y + size.Y / 2);
                buttonTextLabel.transparency   = _transparency;
                buttonTextLabel.enabled        = enabled;
                buttonTextLabel.Draw(spriteBatch);
            }

            spriteBatch.Draw(image, new Rectangle((int)(position.X + size.X - sideImageSize.X - widthPadding), (int)(position.Y + ((size.Y - sideImageSize.Y) / 2)), (int)sideImageSize.X, (int)sideImageSize.Y), _color * _transparency);
        }
Esempio n. 2
0
 protected Vector2 SizeOfTitleString()
 {
     return(HelperFunctions.SizeOfString(titleFont, titleString));
 }
 public Vector2 SizeOfString()
 {
     return(HelperFunctions.SizeOfString(font, text));
 }