AndEngine中的TexturePack类添加对TiledTextureRegion的支持

最近的新版AndEngine已经全面支持TexturePacker生成的TextureSheet,而且支持PVR和压缩过的PVR.ccz,这样管理游戏中的各种图片资源就更加方便了,再也不用自己绞尽脑汁的管理N多图片了。。。

但是目前有一点还不是很方便,那就是AndEngine中TexturePack类中只能提取出TextureRegion,不支持TiledTextureRegion的提取,换言之就是TiledTextureRegion的实例,如一些动画等等,无法一起放在TextureSheet中统一管理,造成了些许不便
经过对AndEngin的研究,使用曲线救国法成功克服了这一问题,但还是希望AndEngine能尽快提供正式支持


TextureRegion tempRegion=texturePack.getTexturePackTextureRegionLibrary().get(pTextureID); 
TiledTextureRegion tiled=new TiledTextureRegion(texturePack.getTexture(), tempRegion.getTexturePositionX(), tempRegion.getTexturePositionY(), tempRegion.getWidth(), tempRegion.getHeight(), pTileColumns, pTileRows).deepCopy(); 
     

你可能感兴趣的:(AndEngine)