Difference between revisions of "D3d.DrawText"
From Nomad DB
(Created page with "Draws text onto the screen at the given position. Font is set using d3d.SetFont and the text color in d3d.SetColor. If you want to measure the text size before renderi...") |
|||
Line 1: | Line 1: | ||
+ | {{Page_WD2}}{{Page_MDE}}{{Page_WDL}} | ||
Draws text onto the screen at the given position. Font is set using [[d3d.SetFont]] and the text color in [[d3d.SetColor]]. If you want to measure the text size before rendering, you can use [[d3d.MeasureText]]. | Draws text onto the screen at the given position. Font is set using [[d3d.SetFont]] and the text color in [[d3d.SetColor]]. If you want to measure the text size before rendering, you can use [[d3d.MeasureText]]. | ||
Line 21: | Line 22: | ||
== Related Pages == | == Related Pages == | ||
− | * [[ | + | * [[ScriptHook: Rendering]] |
* [[d3d.SetFont]] | * [[d3d.SetFont]] | ||
* [[d3d.MeasureText]] | * [[d3d.MeasureText]] | ||
* [[d3d.SetColor]] | * [[d3d.SetColor]] | ||
+ | [[Category:WD2 ScriptHook Lua]] | ||
[[Category:WD2 ScriptHook Lua]] | [[Category:WD2 ScriptHook Lua]] |
Latest revision as of 11:13, 15 April 2021
Draws text onto the screen at the given position. Font is set using d3d.SetFont and the text color in d3d.SetColor. If you want to measure the text size before rendering, you can use d3d.MeasureText.
This function can only be called from inside OnRender event!
Syntax
d3d.DrawText(x, y, text)
- x, y: number (Position)
- text: string (Text)
Example
function script:OnRender()
d3d.SetColor(255, 0, 0) --red
d3d.SetFont("Arial", 20)
d3d.DrawText(50, 50, "Hello NomadDB!")
end