GetTextWidth(string text, FontType font)
Returns the width on the screen that drawing TEXT in FONT on one line would take up.
This could be useful if you manually need to centre or right-align some text, for
example with the raw drawing routines.
The width is returned in normal 320-resolution pixels, so it can be used with the
screen display commands.
Example:
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawingColor = 14;
int width = GetTextWidth("Hello!", Game.NormalFont);
surface.DrawString(160 - (width / 2), 100, Game.NormalFont, "Hello!");
surface.Release();
will print "Hello!" onto the middle of the background scene.
See Also: GetTextHeight, DrawingSurface.DrawString
|