Difference between revisions of "TexturePack:getTextureRegion"

From GiderosMobile
m (formatting)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
 
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/TexturePack|TexturePack]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/TexturePack|TexturePack]]<br/>
=== <translate>Description</translate> ===
+
 
<translate><br />
+
=== Description ===
Returns the texture region of texture pack.<br />
+
Returns the texture region of texture pack.
<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
 
(TextureRegion) = TexturePack:getTextureRegion(texturename)
 
(TextureRegion) = TexturePack:getTextureRegion(texturename)
 
</source>
 
</source>
=== <translate>Parameters</translate> ===
+
 
 +
=== Parameters ===
 
'''texturename''': (string) <translate></translate> <br/>
 
'''texturename''': (string) <translate></translate> <br/>
=== <translate>Return values</translate> ===
+
 
'''<translate>Returns</translate>''' (TextureRegion) <translate>TextureRegion by specified name</translate><br/>
+
=== Return values ===
=== <translate>Examples</translate> ===
+
'''Returns''' (TextureRegion) TextureRegion by specified name<br/>
'''Example'''<br/>
+
 
<source lang="lua">local pack = TexturePack.new({"gfx/1.png", "gfx/2.png", "gfx/3.png", "gfx/4.png"})
+
=== Example ===
 +
<source 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 region1 = pack:getTextureRegion("gfx/1.png")
 
local region2 = pack:getTextureRegion("gfx/2.png")
 
local region2 = pack:getTextureRegion("gfx/2.png")
 
local region3 = pack:getTextureRegion("gfx/3.png")
 
local region3 = pack:getTextureRegion("gfx/3.png")
local region4 = pack:getTextureRegion("gfx/4.png")</source>
+
local region4 = pack:getTextureRegion("gfx/4.png")
 +
</source>
  
 
{{TexturePack}}
 
{{TexturePack}}

Revision as of 22:06, 22 March 2020


Available since: Gideros 2011.6
Class: TexturePack

Description

Returns the texture region of texture pack.

(TextureRegion) = TexturePack:getTextureRegion(texturename)

Parameters

texturename: (string)

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")