DxDrawText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client function}} ==Syntax== <syntaxhighlight lang="lua"> </syntaxhighlight> ===Required Arguments=== ===Returns=== ==Example== <syntaxhighlight lang="lua"> --TODO </syntaxhighlight> ==See Also== {{Drawing_functions}})
 
No edit summary
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
 
dxDrawText ( string text, int left, int top [, int right=left, int bottom=top, int color=white, float scale=1, string font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false] )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===  
===Required Arguments===  
*'''text:''' the text to draw
*'''left:''' the absolute X coordinate of the top left corner of the text
*'''top:''' the absolute Y coordinate of the top left corner of the text


===Optional Arguments===
*'''right:''' the X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking.
*'''bottom:''' the Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking.
*'''color:''' the color of the text, a value produced by [[tocolor]].
*'''scale:''' the size of the text.
*'''font:''' the dx font to use.
{{DxFonts}}
*'''alignX:''' horizontal alignment of the text within the bounding box. Can be '''"left"''', '''"center"''' or '''"right"'''.
*'''alignY:''' vertical alignment of the text within the bounding box. Can be '''"top"''', '''"center"''' or '''"bottom"'''.
*'''clip:''' if set to ''true'', the parts of the text that don't fit within the bounding box will be cut off.
*'''wordBreak:''' if set to ''true'', the text will wrap to a new line whenever it reaches the right side of the bounding box. If ''false'', the text will always be completely on one line.


===Returns===
===Returns===
 
Returns ''true'' if successful, ''false'' otherwise.


==Example==  
==Example==  

Revision as of 14:10, 5 March 2008

Syntax

dxDrawText ( string text, int left, int top [, int right=left, int bottom=top, int color=white, float scale=1, string font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false] )

Required Arguments

  • text: the text to draw
  • left: the absolute X coordinate of the top left corner of the text
  • top: the absolute Y coordinate of the top left corner of the text

Optional Arguments

  • right: the X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking.
  • bottom: the Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking.
  • color: the color of the text, a value produced by tocolor.
  • scale: the size of the text.
  • font: the dx font to use.
    • "default": Tahoma
    • "default-bold": Tahoma Bold
    • "clear": Verdana
    • "arial": Arial
    • "sans": Microsoft Sans Serif
    • "pricedown": Pricedown (GTA's theme text)
    • "bankgothic": Bank Gothic Medium
    • "diploma": Diploma Regular
    • "beckett": Beckett Regular
    • "unifont": Unifont
  • alignX: horizontal alignment of the text within the bounding box. Can be "left", "center" or "right".
  • alignY: vertical alignment of the text within the bounding box. Can be "top", "center" or "bottom".
  • clip: if set to true, the parts of the text that don't fit within the bounding box will be cut off.
  • wordBreak: if set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line.

Returns

Returns true if successful, false otherwise.

Example

--TODO

See Also