Changes

Jump to navigation Jump to search

gc:drawString

253 bytes added, 13:26, 18 June 2012
no edit summary
Line 24: Line 24:  
| <u><center>position</center></u> || string || the string’s anchor point. It can either be "baseline", “bottom”, “middle”, or “top”.
 
| <u><center>position</center></u> || string || the string’s anchor point. It can either be "baseline", “bottom”, “middle”, or “top”.
 
|}
 
|}
== Example ==
+
== Example ==
 
<syntaxhighlight>function on.paint(gc)
 
<syntaxhighlight>function on.paint(gc)
 
     gc:drawString("Hello World", 0, 0, "top")
 
     gc:drawString("Hello World", 0, 0, "top")
 
end</syntaxhighlight>
 
end</syntaxhighlight>
 
will display&nbsp;&nbsp;&nbsp; Hello World &nbsp;&nbsp;&nbsp; at the top-left part of the screen.
 
will display&nbsp;&nbsp;&nbsp; Hello World &nbsp;&nbsp;&nbsp; at the top-left part of the screen.
 +
 +
== Good to know ==
 +
In order to clear up what 'position' does, here's an animated image with the 4 possibilities, showing a text that is drawn at the same 60;60 coordinates, but with different "position" attributes.
 +
[[File:drawString_text_position.gif]]
    
<br /><br />
 
<br /><br />
 
[[Category:gc]]
 
[[Category:gc]]

Navigation menu