Code archives/Miscellaneous/Centering Text

This code has been declared by its author to be Public Domain code.

Download source code

Centering Text by Eric2006
A drop in replacement for the DrawText..
DrawText "Centered",512,368,1,1
Centers the text on both the Y and Y.
Simple I know...But very Useful
Function DrawText(N:String , X:Int , Y:Int , XO:Byte=False , YO:Byte=False)
	Local XL:Float = 0
	Local YL:Float = 0
	If XO = True Then XL = TextWidth(N) / 2
	
	If YO = True Then YL = TextHeight(N) / 2
	BRL.Max2D.DrawText(N , X - XL , Y - YL)
End Function

Comments

None.

Code Archives Forum