draw.DrawText

From GMod Wiki

Revision as of 19:32, 20 September 2011 by [KOTL] Fullmetal (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax draw.DrawText( String Text, String Font, Number X, Number Y, Color Color, Number Xalign )
Where is this used?
Description:
Draws text at the specified position on the screen, with your choice of font/colour/text-align.
Returns: nil
Part of Library: Draw
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Draw.DrawText]Draw.DrawText [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionPrint text on the screen.
Used onNewerClient.png
Code
 
function GM:HUDPaint()
    draw.DrawText("Hello World", "ScoreboardText", ScrW() / 2 - 70, ScrH() - 63, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER)
end
 
OutputPrints "Hello World" on the screen.


Additional Notes

Valid values for xalign and yalign:

SHARED | 0000000000000000 | 00000000000000000 | TEXT_ALIGN_LEFT
SHARED | 0000000000000001 | 00000000000000001 | TEXT_ALIGN_CENTER
SHARED | 0000000000000002 | 00000000000000010 | TEXT_ALIGN_RIGHT
SHARED | 0000000000000003 | 00000000000000011 | TEXT_ALIGN_TOP
SHARED | 0000000000000004 | 00000000000000100 | TEXT_ALIGN_BOTTOM

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox