DrawText: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|DrawText(text, sX, sY [, scale, r, g, b])}} {{FuncParameters}} {{FuncParam|text|__EDIT_ME__}} {{Fu..."
 
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Client|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{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(text, sX, sY [, scale, r, g, b])}}
{{FuncSyntax|DrawText(x, y, text)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|text|__EDIT_ME__}}
{{FuncParam|x|The X axis on the screen.}}
{{FuncParam|sX|__EDIT_ME__}}
{{FuncParam|y|The Y axis on the screen.}}
{{FuncParam|sY |__EDIT_ME__}}
{{FuncParam|text|The text you want to draw on the client screen.}}
{{FuncParam|scale|__EDIT_ME__}}
{{FuncParam|r|__EDIT_ME__}}
{{FuncParam|g|__EDIT_ME__}}
{{FuncParamOptional|b|__EDIT_ME__}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns '''nil'''.}}


== Example ==
== Example ==
__EDIT_ME__
<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}}
__EDIT_ME__
* [[DrawText]]
* [[SetDrawColor]]
* [[SetTextDrawScale]]
* [[GetTextSize]]
* [[DrawLine]]
* [[DrawLine3D]]
* [[DrawPoint3D]]
* [[DrawCircle3D]]
* [[DrawBox]]
* [[DrawRect]]
* [[DrawTexture]]
* [[DrawTextureEx]]
* [[DrawMaterial]]

Latest revision as of 20:25, 30 August 2020

DrawText

Type: Function
Context: Client
Introduced: v1.0

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)

See also