简体   繁体   English

在背景中加载 - AndEngine GLES2

[英]Loading In Background - AndEngine GLES2

im porting my project in AndEngine GLES2, with GLES1 versione i use this tutorial to load assets in background, now i receive this error: 我在AndEngine GLES2中移植我的项目,使用GLES1版本我使用本教程在后台加载资源,现在我收到此错误:

mActivity.onCreateScene failed. @(Thread: 'GLThread 10')
java.lang.ExceptionInInitializerError

This is my onCreateScene method 这是我的onCreateScene方法

    @Override
    public Scene onCreateScene() {
        this.mEngine.registerUpdateHandler(new FPSLogger());
        SplashScene mSplashScene = new SplashScene(this);

        IAsyncCallback callback = new IAsyncCallback() {

            @Override
            public void workToDo() {
            //Do something}

            @Override
            public void onComplete() {
                LoadingScene mLoadingScene = new LoadingScene(mActivity.this);
                mActivity.this.getEngine().setScene(mLoadingScene);
            }
        };

        new AsyncTaskLoader().execute(callback);

        return mSplashScene;
    }

Change 更改

new AsyncTaskLoader().execute(callback);

to

    //Fixed variant working with gles1 and gles2
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AsyncTaskLoader().execute(callback);
        }
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM