예제 #1
0
        public static void doRightAlignedBackingLabelScaled(Rectangle dest, string msg, SpriteFont font, Color back, Color front)
        {
            GuiData.spriteBatch.Draw(Utils.white, dest, back);
            Vector2 vector2_1 = font.MeasureString(msg);

            Vector2[] stringScaleForSize = TextItem.GetStringScaleForSize(font, msg, dest);
            Vector2   scale     = stringScaleForSize[0];
            Vector2   vector2_2 = stringScaleForSize[1];
            Vector2   vector2_3 = vector2_1 * scale;
            Vector2   position  = new Vector2((float)(dest.X + dest.Width) - vector2_3.X, (float)(dest.Y + dest.Height / 2) - vector2_3.Y / 2f);

            GuiData.spriteBatch.DrawString(font, msg, position, front, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.6f);
        }
예제 #2
0
        public static void doRightAlignedBackingLabelFill(Rectangle dest, string msg, SpriteFont font, Color back, Color front)
        {
            GuiData.spriteBatch.Draw(Utils.white, dest, back);
            Vector2   vector2_1 = font.MeasureString(msg);
            Rectangle dest1     = dest;

            dest1.Width -= 7;
            dest1.X     += 4;
            Vector2[] stringScaleForSize = TextItem.GetStringScaleForSize(font, msg, dest1);
            Vector2   scale     = stringScaleForSize[0];
            Vector2   vector2_2 = stringScaleForSize[1];

            vector2_2.Y *= 2f;
            vector2_2.Y -= 3f;
            Vector2 vector2_3 = new Vector2((float)dest1.X, (float)dest.Y);

            GuiData.spriteBatch.DrawString(font, msg, vector2_3 + vector2_2, front, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.6f);
            Rectangle destinationRectangle = new Rectangle(dest.X, (int)((double)dest.Y + (double)vector2_2.Y - 4.0 + (double)vector2_1.Y * (double)scale.Y), dest.Width, 1);

            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, front);
        }