TextureRegion
From GiderosMobile
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")<br />
<br />
-- define 4 equal regions of size 100x100 from "atlas.png"<br />
local region1 = TextureRegion.new(texture, 0, 0, 100, 100)<br />
local region2 = TextureRegion.new(texture, 100, 0, 100, 100)<br />
local region3 = TextureRegion.new(texture, 100, 100, 100, 100)<br />
local region4 = TextureRegion.new(texture, 0, 100, 100, 100)<br />
<br />
-- add these regions to scene tree<br />
local bitmap1 = Bitmap.new(region1)<br />
local bitmap2 = Bitmap.new(region2)<br />
local bitmap3 = Bitmap.new(region3)<br />
local bitmap4 = Bitmap.new(region4)<br />
<br />
stage:addChild(bitmap1)<br />
stage:addChild(bitmap2)<br />
stage:addChild(bitmap3)<br />
stage:addChild(bitmap4)
MethodsTextureRegion.new - creates a new TextureRegion object |
EventsConstants |