DrawText: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription|Draws a text on the player screen.}} | {{FuncDescription|Draws a text on the player screen. The X and Y axis are the screen coordinates which start from upper-left corner instead of center.}} | ||
{{FuncSyntax|DrawText(x, y, text)}} | {{FuncSyntax|DrawText(x, y, text)}} | ||
Line 10: | Line 10: | ||
{{FuncParam|text|The text you want to draw on the client screen.}} | {{FuncParam|text|The text you want to draw on the client screen.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns '''nil'''.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang='Lua'> | |||
AddEvent("OnRenderHUD", function () | |||
local w, h = GetScreenSize() -- Gets the screen size of the client | |||
DrawText(w / 2, h / 2, "Some text in the center of your screen!") -- Creates the text in the center of the client's screen | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
Line 27: | Line 32: | ||
* [[DrawRect]] | * [[DrawRect]] | ||
* [[DrawTexture]] | * [[DrawTexture]] | ||
* [[DrawTextureEx]] | |||
* [[DrawMaterial]] |
Latest revision as of 20:25, 30 August 2020
Description
Draws a text on the player screen. The X and Y axis are the screen coordinates which start from upper-left corner instead of center.
Syntax
DrawText(x, y, text)
Parameters
- x
The X axis on the screen. - y
The Y axis on the screen. - text
The text you want to draw on the client screen.
Return Value
- Returns nil.
Example
AddEvent("OnRenderHUD", function ()
local w, h = GetScreenSize() -- Gets the screen size of the client
DrawText(w / 2, h / 2, "Some text in the center of your screen!") -- Creates the text in the center of the client's screen
end)