TexturePack:getTextureRegion: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
<languages />
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
'''Class:''' [[TexturePack]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/TexturePack|TexturePack]]<br/>
 
=== <translate>Description</translate> ===
=== Description ===
<translate><br />
Returns the texture region for the given texture name.
Returns the texture region of texture pack.<br />
<syntaxhighlight lang="lua">
<br /></translate>
<source lang="lua">
(TextureRegion) = TexturePack:getTextureRegion(texturename)
(TextureRegion) = TexturePack:getTextureRegion(texturename)
</source>
</syntaxhighlight>
=== <translate>Parameters</translate> ===
 
'''texturename''': (string) <translate></translate> <br/>
=== Parameters ===
=== <translate>Return values</translate> ===
'''texturename''': (string) packed texture path<br/>
'''<translate>Returns</translate>''' (TextureRegion) <translate>TextureRegion by specified name</translate><br/>
 
=== <translate>Examples</translate> ===
=== Return values ===
'''Example'''<br/>
'''Returns''' (TextureRegion) TextureRegion by specified name<br/>
<source lang="lua">local pack = TexturePack.new({&quot;gfx/1.png&quot;, &quot;gfx/2.png&quot;, &quot;gfx/3.png&quot;, &quot;gfx/4.png&quot;})
 
=== Example ===
<syntaxhighlight lang="lua">
local pack = TexturePack.new({"gfx/1.png", "gfx/2.png", "gfx/3.png", "gfx/4.png"})
 
local region1 = pack:getTextureRegion("gfx/1.png")
local region2 = pack:getTextureRegion("gfx/2.png")
local region3 = pack:getTextureRegion("gfx/3.png")
local region4 = pack:getTextureRegion("gfx/4.png")
</syntaxhighlight>


local region1 = pack:getTextureRegion(&quot;gfx/1.png&quot;)
{{TexturePack}}
local region2 = pack:getTextureRegion(&quot;gfx/2.png&quot;)
local region3 = pack:getTextureRegion(&quot;gfx/3.png&quot;)
local region4 = pack:getTextureRegion(&quot;gfx/4.png&quot;)</source>

Latest revision as of 13:33, 13 July 2023

Available since: Gideros 2011.6
Class: TexturePack

Description

Returns the texture region for the given texture name.

(TextureRegion) = TexturePack:getTextureRegion(texturename)

Parameters

texturename: (string) packed texture path

Return values

Returns (TextureRegion) TextureRegion by specified name

Example

local pack = TexturePack.new({"gfx/1.png", "gfx/2.png", "gfx/3.png", "gfx/4.png"})

local region1 = pack:getTextureRegion("gfx/1.png")
local region2 = pack:getTextureRegion("gfx/2.png")
local region3 = pack:getTextureRegion("gfx/3.png")
local region4 = pack:getTextureRegion("gfx/4.png")