SetDrawColor: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
{{FuncDescription|Sets the color that will be used by all Draw* functions.}}
{{FuncDescription|Sets the color that will be used by all Draw* functions.}}


{{FuncSyntax|SetDrawColor(HexColor)}}
{{FuncSyntax|SetDrawColor(IntColor)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|HexColor|__EDIT_ME__}}
{{FuncParam|IntColor|Color as an integer from [[RGBA]].}}


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


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
local x, y, z = GetPlayerLocation()
local ScreenX, ScreenY = GetScreenSize()
SetDrawColor(RGB(255, 255, 255)) -- White color
DrawText(2, ScreenY - 40, tostring("Player location: "..x..", "..y..", "..z))
SetDrawColor(RGB(255, 0, 0)) -- Red color
DrawText(2, ScreenY - 55, "Some other text")
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
Line 25: Line 32:
* [[DrawRect]]
* [[DrawRect]]
* [[DrawTexture]]
* [[DrawTexture]]
* [[DrawTextureEx]]
* [[DrawMaterial]]

Latest revision as of 20:25, 30 August 2020

SetDrawColor

Type: Function
Context: Client
Introduced: v1.0

Description

Sets the color that will be used by all Draw* functions.

Syntax

SetDrawColor(IntColor)

Parameters

  • IntColor
    Color as an integer from RGBA.

Return Value

  • Returns true.

Example

local x, y, z = GetPlayerLocation()
local ScreenX, ScreenY = GetScreenSize()
SetDrawColor(RGB(255, 255, 255)) -- White color
DrawText(2, ScreenY - 40, tostring("Player location: "..x..", "..y..", "..z))
SetDrawColor(RGB(255, 0, 0)) -- Red color
DrawText(2, ScreenY - 55, "Some other text")

See also