surface.SetTextPos

From GMod Wiki

Jump to: navigation, search
Function
Syntax surface.SetTextPos( Number x, Number y )
Where is this used?
Description:
Sets the current text position, relative to the top-left corner of the block of text.
Returns: nil
Part of Library: surface
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Surface.SetTextPos]Surface.SetTextPos [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDraws text in the middle of the screen
Used onNewerClient.png
Code
function centerText()
    surface.SetTextColor( 255, 255, 255, 255 )
    surface.SetTextPos( ScrW() / 2, ScrH() / 2 )
    surface.DrawText( "My origin is in the middle of the screen ^_^" )
end
 
hook.Add("HUDPaint", "drawCenterText", centerText)
OutputDraws "My origin is in the middle of the screen ^_^" in the middle of the screen.


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox