启动画面闪烁并从应用程序中抛出

时间:2015-03-21 18:29:16

标签: android andengine

我正在使用AndEngine创建2D游戏,并且splashScene无法正常工作。如果有人能帮我解决这个错误,我将不胜感激

enter image description here

SplashScene

public class SplashScene extends BaseScene {

    @Override
    public void createScene() {
        Sprite splash = new Sprite(0, 0, mResourceManager.mSplashTextureRegion, mVertexBufferObjectManager) {
            @Override
            protected void preDraw(GLState pGLState, Camera pCamera)
            {
                super.preDraw(pGLState, pCamera);
                pGLState.enableDither();
            }
        };
        attachChild(splash);

        Text copyrightText = new Text(0, 0, mResourceManager.mFont1, "(c)", new TextOptions(HorizontalAlign.LEFT), mVertexBufferObjectManager);
        copyrightText.setPosition(SCREEN_WIDTH - copyrightText.getWidth()-5, SCREEN_HEIGHT - copyrightText.getHeight()-5);
        attachChild(copyrightText);
    }

    @Override
    public void onBackKeyPressed() {
        mActivity.finish();
    }

    @Override
    public SceneManager.SceneType getSceneType() {
        return SceneManager.SceneType.SCENE_SPLASH;
    }

    @Override
    public void disposeScene() {
    }
}
public static final int CAMERA_WIDTH = 320;
public static final int CAMERA_HEIGHT = 480;

@Override
public EngineOptions onCreateEngineOptions() {
    mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
    engineOptions.getAudioOptions().setNeedsSound(true).setNeedsMusic(true);
    return engineOptions;
}

0 个答案:

没有答案