Garry's Mod Wiki

Revision Difference

MarkupObject:Draw#546204

<function name="Draw" parent="MarkupObject" type="classfunc"> <description>Draws the computed markupobject to the screen.</description> <realm>Client</realm> <args> <arg name="xOffset" type="number">The X coordinate on the screen.</arg> <arg name="yOffset" type="number">The Y coordinate on the screen.</arg> <arg name="xAlign" type="number">The alignment of the x coordinate using <page>Enums/TEXT_ALIGN</page></arg> <arg name="yAlign" type="number">The alignment of the y coordinate using <page>Enums/TEXT_ALIGN</page></arg> <arg name="alphaoverride" type="number" default="255">Sets the alpha of all drawn objects to this.</arg> </args> </function> ⤶ <example>⤶ <description>Renders a markup string on the HUD.⤶ <note>The the <colour> tag can also be written as <color>, and the <font> tag can also be written as <face></note></description>⤶ <code>⤶ local parsed = markup.Parse("<font=Default>changed font</font>\n<colour=255,0,255,255>changed colour</colour>")⤶ ⤶ hook.Add("HUDPaint", "MarkupTest", function()⤶ parsed:Draw(100, 100, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)⤶ end)⤶ </code>⤶ <output><image src="Screenshot-2012-08-30_13.13.59.png"/></output>⤶ ⤶ </example>