Difference between revisions of "TextureRegion"
From GiderosMobile
Line 4: | Line 4: | ||
=== Description === | === Description === | ||
<translate><br /> | <translate><br /> | ||
− | The [[TextureRegion]] class specifies a texture and a rectangular region in it. It is used to define independent texture regions<br /> | + | The [[Special:MyLanguage/TextureRegion|TextureRegion]] class specifies a texture and a rectangular region in it. It is used to define independent texture regions<br /> |
within a texture atlas which is a large image, which contains many smaller sub-images.<br /> | within a texture atlas which is a large image, which contains many smaller sub-images.<br /> | ||
<br /></translate> | <br /></translate> | ||
Line 30: | Line 30: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
− | [[TextureRegion.new]] ''<translate>creates a new TextureRegion object</translate>''<br/> | + | [[Special:MyLanguage/TextureRegion.new|TextureRegion.new]] ''<translate>creates a new TextureRegion object</translate>''<br/> |
− | [[TextureRegion.new]] <br/> | + | [[Special:MyLanguage/TextureRegion.new|TextureRegion.new]] <br/> |
− | [[TextureRegion:getRegion]] ''<translate>returns the coordinates of the region</translate>''<br/> | + | [[Special:MyLanguage/TextureRegion:getRegion|TextureRegion:getRegion]] ''<translate>returns the coordinates of the region</translate>''<br/> |
− | [[TextureRegion:getScale]] ''<translate>returns the scale ratio of the underlying atlas</translate>''<br/> | + | [[Special:MyLanguage/TextureRegion:getScale|TextureRegion:getScale]] ''<translate>returns the scale ratio of the underlying atlas</translate>''<br/> |
− | [[TextureRegion:setRegion]] ''<translate>sets the coordinates of the region</translate>''<br/> | + | [[Special:MyLanguage/TextureRegion:setRegion|TextureRegion:setRegion]] ''<translate>sets the coordinates of the region</translate>''<br/> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
|} | |} |
Revision as of 16:33, 23 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6
Description
The TextureRegion class specifies a texture and a rectangular region in it. It is used to define independent texture regions
within a texture atlas which is a large image, which contains many smaller sub-images.
Examples
Example
local texture = Texture.new("atlas.png")
-- define 4 equal regions of size 100x100 from "atlas.png"
local region1 = TextureRegion.new(texture, 0, 0, 100, 100)
local region2 = TextureRegion.new(texture, 100, 0, 100, 100)
local region3 = TextureRegion.new(texture, 100, 100, 100, 100)
local region4 = TextureRegion.new(texture, 0, 100, 100, 100)
-- add these regions to scene tree
local bitmap1 = Bitmap.new(region1)
local bitmap2 = Bitmap.new(region2)
local bitmap3 = Bitmap.new(region3)
local bitmap4 = Bitmap.new(region4)
stage:addChild(bitmap1)
stage:addChild(bitmap2)
stage:addChild(bitmap3)
stage:addChild(bitmap4)
MethodsTextureRegion.new creates a new TextureRegion object |
EventsConstants |