Vice City: Multiplayer

VC:MP Discussion => Support => Bugs and Crashes => Topic started by: Pun1sh3r on Dec 25, 2020, 12:50 PM

Title: [Bug] Gui.TextAlignment not working?
Post by: Pun1sh3r on Dec 25, 2020, 12:50 PM
 I tried to create a GUI Text which should be Center but it does nothing? Also tried the rest which is written in the Wiki Page

QuoteFooterText = GUILabel( );
            FooterText.Pos = VectorScreen( sX/7, sY-(sY/28) );
       FooterText.TextAlignment = GUI_ALIGN_CENTER;
            FooterText.FontSize = 20;
            FooterText.TextColour = Colour( 255, 255, 255 );
            FooterText.FontFlags = GUI_FFLAG_BOLD;
            FooterText.Text = FooterString;

QuoteProperty TextAlignment

Type: int

Sets the alignment of text. Available constants are:

GUI_ALIGN_LEFT
GUI_ALIGN_RIGHT
GUI_ALIGN_TOP
GUI_ALIGN_BOTTOM
GUI_ALIGN_CENTERV
GUI_ALIGN_CENTERH
GUI_ALIGN_CENTER

Anything wrong with my Code?
Title: Re: [Bug] Gui.TextAlignment not working?
Post by: DizzasTeR on Dec 25, 2020, 12:56 PM
Provide a size to the text element. If you are going to use alignment, you have to make sure you "create" a "bounding box" where:

left => Position.X
top => Position.Y
right => Size.X
bottom => Size.Y

Then apply the alignment flags
Title: Re: [Bug] Gui.TextAlignment not working?
Post by: Pun1sh3r on Dec 25, 2020, 02:47 PM
Can you provide me a example code?
Title: Re: [Bug] Gui.TextAlignment not working?
Post by: DizzasTeR on Dec 26, 2020, 03:10 AM
FooterText = GUILabel( );
FooterText.Position = VectorScreen(0, 0); // x is left, y is top
FooterText.Size = VectorScreen(sX, sY); // x is right, y is bottom
FooterText.TextAlignment = GUI_ALIGN_CENTER; // Align it at center
FooterText.FontSize = 20;
FooterText.TextColour = Colour( 255, 255, 255 );
FooterText.FontFlags = GUI_FFLAG_BOLD;
FooterText.Text = FooterString;

(Untested but thats how it should be)

Also its .Position not .Pos