Exemple #1
0
    public void UI_DrawText(string Text, TextAlignment_t TextAlignment, Vector2 Position, Font Style, Brush Brush)
    {
        // Get the Size of the String if it where drawn
        Vector2 strWidth = GetTextInfo(Text, Style);

        switch (TextAlignment)
        {
        case TextAlignment_t.TOP_LEFT:
            UI_DrawText(Text, new Vector2(Position.x, Position.y + strWidth.y), Style, Brush);
            break;

        case TextAlignment_t.TOP_RIGHT:
            UI_DrawText(Text, new Vector2(Position.x + VSInfo.Width - strWidth.x, Position.y + strWidth.y), Style, Brush);
            break;

        case TextAlignment_t.TOP_CENTER:
            UI_DrawText(Text, new Vector2(Position.x + VSInfo.Width / 2 - strWidth.x / 2, Position.y + strWidth.y), Style, Brush);
            break;



        case TextAlignment_t.CENTER_LEFT:
            UI_DrawText(Text, new Vector2(Position.x, Position.y + VSInfo.Height / 2 - strWidth.y / 2), Style, Brush);
            break;

        case TextAlignment_t.CENTER_RIGHT:
            UI_DrawText(Text, new Vector2(Position.x + VSInfo.Width - strWidth.x, Position.y + VSInfo.Height / 2 - strWidth.y / 2), Style, Brush);
            break;

        case TextAlignment_t.CENTER_CENTER:
            UI_DrawText(Text, new Vector2(Position.x + VSInfo.Width / 2 - strWidth.x / 2, Position.y + VSInfo.Height / 2 - strWidth.y / 2), Style, Brush);
            break;


        case TextAlignment_t.BOTTOM_LEFT:
            UI_DrawText(Text, new Vector2(Position.x, Position.y + VSInfo.Height - strWidth.y), Style, Brush);
            break;

        case TextAlignment_t.BOTTOM_RIGHT:
            UI_DrawText(Text, new Vector2(Position.x + VSInfo.Width - strWidth.x, Position.y + VSInfo.Height - strWidth.y), Style, Brush);
            break;

        case TextAlignment_t.BOTTOM_CENTER:
            UI_DrawText(Text, new Vector2(Position.x + VSInfo.Width / 2 - strWidth.x / 2, Position.y + VSInfo.Height - strWidth.y), Style, Brush);
            break;
        }
    }
Exemple #2
0
 public void UI_DrawText(string Text, TextAlignment_t TextAlignment, Font Style, Brush Brush)
 {
     UI_DrawText(Text, TextAlignment, new Vector2(0, 0), Style, Brush);
 }