DrawTexture: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|DrawTexture()}} {{FuncParameters}} {{FuncNoParam}} {{FuncReturnValue|__EDIT_ME__}} == Example ==..."
 
No edit summary
 
(9 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 an UTexture on screen. https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/AHUD/DrawTextureSimple/index.html}}


{{FuncSyntax|DrawTexture()}}
{{FuncSyntax|DrawTexture(UTexture TextureReference, ScreenX, ScreenY, Scale, bScalePosition)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncNoParam}}
{{FuncParam|TextureReference|Texture reference from LoadFromAsset or LoadFromFile.}}
{{FuncParam|ScreenX|Screen X location.}}
{{FuncParam|ScreenY|Screen Y location.}}
{{FuncParam|Scale|Draw scale. (Use 1.0 for default)}}
{{FuncParam|bScalePosition|Whether the "Scale" parameter should also scale the position of this draw call. (Use '''false''' for default)}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns nothing.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
local tex
local tex2
 
function OnPackageStart()
tex = UTexture2D.LoadFromAsset("/Game/Weapons/Images/T_Pistol01")
tex2 = UTexture2D.LoadFromFile("freeroam/usa.png")
end
AddEvent("OnPackageStart", OnPackageStart)
 
AddEvent("OnRenderHUD", function()
DrawTexture(tex, 110, 110, 0.2, false)
DrawTexture(tex2, 140, 140, 0.1, false)
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[DrawText]]
* [[SetDrawColor]]
* [[SetTextDrawScale]]
* [[GetTextSize]]
* [[DrawLine]]
* [[DrawLine3D]]
* [[DrawPoint3D]]
* [[DrawCircle3D]]
* [[DrawBox]]
* [[DrawRect]]
* [[DrawTexture]]
* [[DrawTextureEx]]
* [[DrawMaterial]]

Latest revision as of 20:24, 30 August 2020

DrawTexture

Type: Function
Context: Client
Introduced: v1.0

Description

Draws an UTexture on screen. https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/AHUD/DrawTextureSimple/index.html

Syntax

DrawTexture(UTexture TextureReference, ScreenX, ScreenY, Scale, bScalePosition)

Parameters

  • TextureReference
    Texture reference from LoadFromAsset or LoadFromFile.
  • ScreenX
    Screen X location.
  • ScreenY
    Screen Y location.
  • Scale
    Draw scale. (Use 1.0 for default)
  • bScalePosition
    Whether the "Scale" parameter should also scale the position of this draw call. (Use false for default)

Return Value

  • Returns nothing.

Example

local tex
local tex2

function OnPackageStart()
	tex = UTexture2D.LoadFromAsset("/Game/Weapons/Images/T_Pistol01")
	tex2 = UTexture2D.LoadFromFile("freeroam/usa.png")
end
AddEvent("OnPackageStart", OnPackageStart)

AddEvent("OnRenderHUD", function()
	DrawTexture(tex, 110, 110, 0.2, false)
	DrawTexture(tex2, 140, 140, 0.1, false)
end)

See also