Difference between revisions of "TexturePack:getTextureRegion"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
+
'''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/>
 
  
 
=== Description ===
 
=== Description ===
Line 11: Line 10:
  
 
=== Parameters ===
 
=== Parameters ===
'''texturename''': (string) <translate></translate> <br/>
+
'''texturename''': (string) texture name<br/>
  
 
=== Return values ===
 
=== Return values ===

Revision as of 00:35, 30 January 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) texture name

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