2014-05-12 46 views
0

我想創建一個使用雪碧主菜單的背景圖像。上述背景雪碧不顯示在attachChilld調用

attachChild(new Sprite(0, 0, resourcesManager.menu_background_region, vbom)); 

該生產線是我打電話給精靈附着到現場。 menu_background_region是我在我的ResourcesManager類中聲明和初始化的ITextureRegion。

BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/menu/"); 
menu_background_region = BitmapTextureAtlasTextureRegionFactory.createFromAsset(menuTextureAtlas, activity, "menubackground.png"); 
try 
    { 
     this.menuTextureAtlas.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 1, 0)); 
     this.menuTextureAtlas.load(); 
    } 
    catch (final TextureAtlasBuilderException e) 
    { 
     Debug.e(e); 
    } 

我的文件路徑聲明和正確的,因爲它並載入我的按鈕爲我的菜單現場,但由於某種原因,我不能要加載的背景圖像正確任何幫助將不勝感激。

回答

0

也許你的圖集是小的,保存精靈/圖片?

menuTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR); 
                     ^ ^

如果你用256256初始化它,那麼它可以是小的。只需增加到1024,1024