DxGetMaterialSize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ {{New feature|3.0110|1.1| Only available in 1.1 }} This gets the dimensions of the supplied material element. ==Syntax== <syntaxhighlight lang="lua"> int, in...")
 
No edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
{{New feature|3.0110|1.1|
Only available in 1.1
}}
This gets the dimensions of the supplied [[material]] element.
This gets the dimensions of the supplied [[material]] element.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int, int dxGetMaterialSize ( element material )
int, int [, int] dxGetMaterialSize ( element material )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[material]]:getSize}}
===Required Arguments===  
===Required Arguments===  
*'''material :''' The material element whose size is to be gotten
*'''material :''' The material element whose size is to be gotten
Line 16: Line 13:
===Returns===
===Returns===
Returns two ''ints'' representing the width and height in pixels of the material, or false if an invalid parameter was passed to the function.  
Returns two ''ints'' representing the width and height in pixels of the material, or false if an invalid parameter was passed to the function.  
If the material is a volume texture, this function will return three ''ints'' representing the width, height and depth.


==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
myTexture = dxCreateTexture( "man.png" )
myTexture = dxCreateTexture( "man.png" )
int width, height = dxGetMaterialSize( myTexture )
local width, height = dxGetMaterialSize( myTexture )
outputChatBox( "man.png is " .. tostring(width) .. " pixels wide and " .. tostring(width) .. " pixels high" )
outputChatBox( "man.png is " .. tostring(width) .. " pixels wide and " .. tostring(height) .. " pixels high" )
</syntaxhighlight>
</syntaxhighlight>
==Changelog==
{{ChangelogHeader}}
{{ChangelogItem|1.3.0-9.04021|Added third return value for volume textures}}


==See Also==
==See Also==
{{Drawing_functions}}
{{Drawing_functions}}
[[hu:dxGetMaterialSize]]

Latest revision as of 11:56, 27 November 2018

This gets the dimensions of the supplied material element.

Syntax

int, int [, int] dxGetMaterialSize ( element material )

OOP Syntax Help! I don't understand this!

Method: material:getSize(...)


Required Arguments

  • material : The material element whose size is to be gotten

Returns

Returns two ints representing the width and height in pixels of the material, or false if an invalid parameter was passed to the function. If the material is a volume texture, this function will return three ints representing the width, height and depth.

Example

myTexture = dxCreateTexture( "man.png" )
local width, height = dxGetMaterialSize( myTexture )
outputChatBox( "man.png is " .. tostring(width) .. " pixels wide and " .. tostring(height) .. " pixels high" )

Changelog

Version Description
1.3.0-9.04021 Added third return value for volume textures

See Also