Difference between revisions of "DxSetTextureEdge"

From Multi Theft Auto: Wiki
(Created page with "{{Client function}} __NOTOC__ {{New items|4.0132|1.3.5| This functions allows you to change the edge handling after creating the texture. }} ==Syntax== <syntaxhighlight lang="lua">bool dxSetTe...")
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Client function}}
 
{{Client function}}
 
__NOTOC__
 
__NOTOC__
{{New items|4.0132|1.3.5|
+
{{New items|3.0135|1.3.5|
 
This functions allows you to change the edge handling after creating the texture.
 
This functions allows you to change the edge handling after creating the texture.
 
}}
 
}}
 +
[[File:TextureEdges.jpg|600px]]
  
 
==Syntax==
 
==Syntax==
 
<syntaxhighlight lang="lua">bool dxSetTextureEdge ( texture theTexture, string textureEdge [, int border-color] )</syntaxhighlight>
 
<syntaxhighlight lang="lua">bool dxSetTextureEdge ( texture theTexture, string textureEdge [, int border-color] )</syntaxhighlight>
 
+
{{OOP||[[texture]]:setEdge}}
 
===Required Arguments===
 
===Required Arguments===
 
*'''theTexture:''' The affected texture
 
*'''theTexture:''' The affected texture
Line 16: Line 17:
  
 
==Example==
 
==Example==
Todo
+
The following example draws the image above ingame.
 +
<section show="true" name="Client" class="client">
 +
<syntaxhighlight lang="lua">local renderTarget1 = dxCreateScreenSource(300, 300)
 +
dxSetTextureEdge(renderTarget1, "wrap")
 +
local renderTarget2 = dxCreateScreenSource(300, 300)
 +
dxSetTextureEdge(renderTarget2, "mirror")
 +
local renderTarget3 = dxCreateScreenSource(300, 300)
 +
dxSetTextureEdge(renderTarget3, "clamp")
 +
local renderTarget4 = dxCreateScreenSource(300, 300)
 +
dxSetTextureEdge(renderTarget4, "border", tocolor(255, 0, 0))
 +
 
 +
addEventHandler("onClientRender", root,
 +
function()
 +
-- Update the screen sources
 +
dxUpdateScreenSource(renderTarget1)
 +
dxUpdateScreenSource(renderTarget2)
 +
dxUpdateScreenSource(renderTarget3)
 +
dxUpdateScreenSource(renderTarget4)
 +
 +
-- Draw screen sources in different modes
 +
dxDrawImageSection(20, 200, 300, 300, -50, 0, 100, 100, renderTarget1)
 +
dxDrawImageSection(350, 200, 300, 300, -50, 0, 100, 100, renderTarget2)
 +
dxDrawImageSection(680, 200, 300, 300, -50, 0, 100, 100, renderTarget3)
 +
dxDrawImageSection(1010, 200, 300, 300, -50, 0, 100, 100, renderTarget4)
 +
end
 +
)</syntaxhighlight></section>
  
 
==See Also==
 
==See Also==
 
{{Drawing_functions}}
 
{{Drawing_functions}}

Latest revision as of 23:41, 13 September 2015

This functions allows you to change the edge handling after creating the texture.

TextureEdges.jpg

Syntax

bool dxSetTextureEdge ( texture theTexture, string textureEdge [, int border-color] )

OOP Syntax Help! I don't understand this!

Method: texture:setEdge(...)

Required Arguments

  • theTexture: The affected texture
  • textureEdge: The texture edge mode. Available modes are wrap, mirror, clamp, border, mirror-once

Optional Arguments

  • border-color: If textureEdge is set to border, you are able to define a border color here

Example

The following example draws the image above ingame.

Click to collapse [-]
Client
local renderTarget1 = dxCreateScreenSource(300, 300)
dxSetTextureEdge(renderTarget1, "wrap")
local renderTarget2 = dxCreateScreenSource(300, 300)
dxSetTextureEdge(renderTarget2, "mirror")
local renderTarget3 = dxCreateScreenSource(300, 300)
dxSetTextureEdge(renderTarget3, "clamp")
local renderTarget4 = dxCreateScreenSource(300, 300)
dxSetTextureEdge(renderTarget4, "border", tocolor(255, 0, 0))

addEventHandler("onClientRender", root,
	function()
		-- Update the screen sources
		dxUpdateScreenSource(renderTarget1)
		dxUpdateScreenSource(renderTarget2)
		dxUpdateScreenSource(renderTarget3)
		dxUpdateScreenSource(renderTarget4)
	
		-- Draw screen sources in different modes
		dxDrawImageSection(20, 200, 300, 300, -50, 0, 100, 100, renderTarget1)
		dxDrawImageSection(350, 200, 300, 300, -50, 0, 100, 100, renderTarget2)
		dxDrawImageSection(680, 200, 300, 300, -50, 0, 100, 100, renderTarget3)
		dxDrawImageSection(1010, 200, 300, 300, -50, 0, 100, 100, renderTarget4)
	end
)

See Also

BETA: FROM VERSION 1.5.7 r19626 ONWARDS
BETA: FROM VERSION 1.5.7 r20328 ONWARDS
BETA: FROM VERSION 1.5.7 r20447 ONWARDS