示例#1
0
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            Rectangle bounds = BackDrop.Bounds;

            Point size = Text.Size;

            origin = bounds.Center - (size.ToVector2() / 2).ToPoint();

            if (Alignment.HasFlag(Alignment.Right))
            {
                origin.X += bounds.Width / 2 - size.X / 2 - Padding.Width;
            }

            if (Alignment.HasFlag(Alignment.Left))
            {
                origin.X -= bounds.Width / 2 - size.X / 2 + Padding.X;
            }

            if (Alignment.HasFlag(Alignment.Bottom))
            {
                origin.Y += bounds.Height / 2 - size.Y / 2 - Padding.Height;
            }

            if (Alignment.HasFlag(Alignment.Top))
            {
                origin.Y -= bounds.Height / 2 - size.Y / 2 + Padding.Y;
            }

            BackDrop.Draw(spriteBatch);


            Text.Draw(spriteBatch, origin);
        }
示例#2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            _backDrop.Draw(spriteBatch);

            foreach (LabelBox l in _labelTexts)
            {
                l.Draw(spriteBatch);
            }
        }