2012-02-15 31 views
-2

加載了很多紋理我加載紋理:如何在andengine

private Texture mTexture; 
... 
    public Textures(final BaseGameActivity activity, final Engine engine) { 

     this.mTexture = new Texture(2048, 1024, 
       TextureOptions.BILINEAR_PREMULTIPLYALPHA); 


     this.mBackgroundTextureRegion = TextureRegionFactory.createFromAsset(
       this.mTexture, activity, "img/back.png", 0, 0); 


     this.mSwingBackTextureRegion = TextureRegionFactory.createFromAsset(
       this.mTexture, activity, "img/player.png", 836, 0); 
... 

我想加載超過200個紋理。這種方法很長。這是如何更快? 我正在GLES1中工作!

回答

0

做到這一點是與紋理帕克最簡單的方法,found here

這使您可以在添加多個圖像文件到一個易於裝載spritesheet。引擎將此spritesheet加載到紋理中,並創建一個類,使您可以輕鬆引用該電子表格中的每個圖像。將200個TextureRegions轉換爲1個TexturePack。

我正在使用GLES2,我不確定GLES1的源文件在哪裏。打開論壇,你應該能夠找到如何使用它們。有很多關於它的討論。