2013-09-09 5 views
1

частная камера mCamera; приватная сцена mMainScene;спрайт выглядит как треугольник

private BitmapTextureAtlas mBitmapTextureAtlas; 
private TextureRegion mPlayerTextureRegion; 

@Override 
public EngineOptions onCreateEngineOptions() { 
    this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); 

    return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera); 
} 
@Override 
public void onCreateResources(
     OnCreateResourcesCallback pOnCreateResourcesCallback) 
     throws Exception { 
    mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32); 
    mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0); 
    mBitmapTextureAtlas.load(); 

} 

@Override 
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) 
     throws Exception { 
    this.mEngine.registerUpdateHandler(new FPSLogger()); 


    this.mMainScene = new Scene(); 
    this.mMainScene.setBackground(new Background(1, 1, 1)); 

    final int iStartX = (CAMERA_WIDTH - mBitmapTextureAtlas.getWidth())/2; 
    final int iStartY = (CAMERA_HEIGHT - mBitmapTextureAtlas.getHeight())/2; 


    final Sprite oPlayer = new Sprite(iStartX, iStartY, mPlayerTextureRegion, getVertexBufferObjectManager()); 
    this.mMainScene.attachChild(oPlayer); 

} 

Мой спрайт выглядит так, как будто он разрезан пополам. Может кто-нибудь объяснить, почему? И цвет фона по-прежнему черный, и он должен быть белым.

ответ

0

Вы должны вернуть сцену в свой метод onCreateScene(). И вы сказали, что ваш спрайт выглядит так, будто он разрезан пополам, может быть, ваш размер изображения больше, чем ваш bitmaptextureAtlas. Если да, увеличьте свой размер текстуры.

+0

Согласовано - но также вызывается pOnCreateResourcesCallback.onCreateResourcesFinished(); – jmroyalty

Смежные вопросы