Difference between revisions of "DrawText"

From King Arthur's Gold Wiki
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 12: Line 12:
 
void GUI::DrawText( const string &text, position2di pos, SColor color )
 
void GUI::DrawText( const string &text, position2di pos, SColor color )
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
'''Example'''
 +
 +
<syntaxhighlight lang="cpp">
 +
void onRender(CRules@ this)
 +
{
 +
  GUI::DrawText("HELLO WORLD", position2di(400, 400), SColor(255, 105, 25, 5));
 +
}
 +
</syntaxhighlight>
 +
 +
[[File:Text.png]]
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]
 
[[Category:Global Functions]]
 
[[Category:Global Functions]]

Latest revision as of 12:30, 6 October 2012

Draws some text.


As this is GUI-related it is client only - it should be wrapped in "if ( getNet().isClient() )" or be in a client-only script.

This method is part of the GUI namespace so you need to prefix calls to it with 'GUI::'.

This method has two variants.

void GUI::DrawText( const string &text, recti rect, SColor color, bool HorCenter, bool VerCenter )
void GUI::DrawText( const string &text, position2di pos, SColor color )

Example

void onRender(CRules@ this)
{
  GUI::DrawText("HELLO WORLD", position2di(400, 400), SColor(255, 105, 25, 5));
}

Text.png