0

我正在使用 Andengine GLES2 Anchor center 分支开发动态壁纸,基于 Development Cookbook。壁纸在中端到高端设备上运行良好,但在低端设备上显示问题。我已经在三星 Galaxy ace、Micromax Funbook 平板电脑和问题生成器三星 Galaxy Y。仅在我拥有的唯一低端设备三星 Galaxy Y 上发现问题。

问题

有时解锁屏幕或返回首页时,我会丢失所有精灵的纹理在我的预览模式下,我必须强制关闭应用程序并重新启动应用程序。

这些是我的动态壁纸的细节,壁纸有一个背景精灵,一个主图像精灵,两个带有一些初始化程序和修改器的 BatchedSpriteParticleSystem 我在资产中有一个用于低端设备(320 * 480)的 sepretae 文件夹,我保留小图像并加载在这种情况下,所有图像都到一个纹理图集,否则我使用两个纹理图集,一个用于背景图像,一个用于我的主图像和两个粒子图像。我使用资源管理器 cals 根据 andengine 食谱加载纹理

请帮我解决问题,我不知道我在哪里出错了这是我的代码......

LiveWallpaperExtensionService 下面给出

LiveWallpaperExtensionService

@TargetApi(13)
public class LiveWallpaperExtensionService extends BaseLiveWallpaperService {

    public Sprite bg_Sprite;
    public Sprite main_image_sprite;
    public SpriteBackground background;

    public BatchedSpriteParticleSystem beamParticleSystem;
    public BatchedSpriteParticleSystem starParticleSystem;

    private Camera mCamera;
    private Scene mScene;


    @Override
    public org.andengine.engine.Engine onCreateEngine(
            final EngineOptions pEngineOptions) {
        return new FixedStepEngine(pEngineOptions, 50);
    }

    public EngineOptions onCreateEngineOptions() {

        Display display = ((WindowManager) getSystemService(WINDOW_SERVICE))
                .getDefaultDisplay();
        Utils.setGlobalWidthandHeight(Utils.getDisplaySize(display));

        mCamera = new Camera(0, 0, Global.Width, Global.Height);

        EngineOptions engineOptions = new EngineOptions(true,
                ScreenOrientation.PORTRAIT_SENSOR, new FillResolutionPolicy(),
                mCamera);

        engineOptions.getRenderOptions().setDithering(true);
        return engineOptions;
    }


    public void onCreateResources(
            OnCreateResourcesCallback pOnCreateResourcesCallback) {

        System.out.println("On create resourses");
        ResourceManager.getInstance().loadBlueTextures(mEngine, this);
        pOnCreateResourcesCallback.onCreateResourcesFinished();

    }

    public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) {
        System.out.println("On create scene");
        mScene = new Scene();
        pOnCreateSceneCallback.onCreateSceneFinished(mScene);
    }

    public void onPopulateScene(Scene arg0,
            OnPopulateSceneCallback pOnPopulateSceneCallback) {

        System.out.println("on populate ");

        final float positionX = Global.Width * 0.5f;
        final float positionY = Global.Height * 0.5f;


        bg_Sprite = new Sprite(positionX, positionY,
                ResourceManager.getInstance().mBackgroundTextureRegion,
                this.getVertexBufferObjectManager());

        main_image_sprite = new Sprite(positionX, positionY,
                ResourceManager.getInstance().mJesusTextureRegion,
                this.getVertexBufferObjectManager());

        /*
         * Define the center point of the particle system spawn location
         */
        final int bparticleSpawnCenterX = (int) (Global.Width * 0.5f);
        final int bparticleSpawnCenterY = (int) ((Global.Height * 0.5f) + ((Global.Height * 0.5f)) * 0.5f) - 25;
        /* Define the radius of the circle for the particle emitter */
        final float particleEmitterRadius = 50;
        /* Create the particle emitter */
        CircleOutlineParticleEmitter bparticleEmitter = new CircleOutlineParticleEmitter(
                bparticleSpawnCenterX, bparticleSpawnCenterY,
                particleEmitterRadius);

        beamParticleSystem = new BatchedSpriteParticleSystem(bparticleEmitter,
                10, 15, 50, ResourceManager.getInstance().mBeamTextureRegion,
                mEngine.getVertexBufferObjectManager());

        beamParticleSystem
                .addParticleInitializer(new ExpireParticleInitializer<UncoloredSprite>(
                        3));

        beamParticleSystem
                .addParticleInitializer(new AccelerationParticleInitializer<UncoloredSprite>(
                        -150, 150, -150, 150));

        RectangleParticleEmitter particleEmitter = new RectangleParticleEmitter(
                ((int) (Global.Width * 0.5f)), ((int) (Global.Height * 0.5f)),
                Global.Width, Global.Height);

        // Create a batched particle system for efficiency
        starParticleSystem = new BatchedSpriteParticleSystem(particleEmitter,
                1, 2, 20, ResourceManager.getInstance().mStarTextureRegion,
                mEngine.getVertexBufferObjectManager());

        /* Add an acceleration initializer to the particle system */

        starParticleSystem
                .addParticleInitializer(new ExpireParticleInitializer<UncoloredSprite>(
                        10));

        starParticleSystem
                .addParticleInitializer(new RotationParticleInitializer<UncoloredSprite>(
                        0, 160));

        /* Define min/max values for the particle's scale */

        starParticleSystem
                .addParticleInitializer(new ScaleParticleInitializer<UncoloredSprite>(
                        0.3f, 1.5f));

        /* Define the alpha modifier's properties */

        starParticleSystem
                .addParticleModifier(new AlphaParticleModifier<UncoloredSprite>(
                        0, 2, 0, 1));

        /* Define the rotation modifier's properties */

        starParticleSystem
                .addParticleModifier(new RotationParticleModifier<UncoloredSprite>(
                        1, 9, 0, 180));

        // Add alpha ('fade out') modifier
        starParticleSystem
                .addParticleModifier(new AlphaParticleModifier<UncoloredSprite>(
                        8, 10, 1, 0));




        /*
         * Create the SpriteBackground object, specifying the color values &
         * Sprite object to display
         */

        final float red = 0.7f;
        final float green = 0.78f;
        final float blue = 0.85f;
        final float alpha = 1;

        background = new SpriteBackground(red, green, blue, bg_Sprite);
        mScene.setBackground(background);
        mScene.setBackgroundEnabled(true);

        // Attach our particle system to the scene
        mScene.attachChild(starParticleSystem);
        mScene.attachChild(beamParticleSystem);

        mScene.attachChild(main_image_sprite);

        bg_Sprite.setIgnoreUpdate(true);
        main_image_sprite.setIgnoreUpdate(true);

        pOnPopulateSceneCallback.onPopulateSceneFinished();
    }

    @Override
    protected synchronized void onPause() {
        System.out.println("On paused");
        super.onPause();

        if (starParticleSystem != null) {
            starParticleSystem.setParticlesSpawnEnabled(false);
        }
        if (beamParticleSystem != null) {
            beamParticleSystem.setParticlesSpawnEnabled(false);
        }

    }

    @Override
    protected synchronized void onResume() {

        System.out.println("On resume");
        super.onResume();

        if (starParticleSystem != null) {
            starParticleSystem.setParticlesSpawnEnabled(true);
        }
        if (beamParticleSystem != null) {
            beamParticleSystem.setParticlesSpawnEnabled(true);
        }

    }


    }



}

请帮我解决这个问题,我欢迎所有的想法建议,任何你的想法来解决这个问题....

4

1 回答 1

2

我注意到 Galaxy Y 有很多问题,我的游戏收到了很多崩溃报告,直到我阻止他们下载它并且所有报告都停止了 [这是唯一有问题的设备]

我建议你这样做

编辑:如果你想选择支持哪些设备,你可以使用这个例子

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:anyDensity="true" />

修改你认为合适的

于 2013-06-25T15:30:06.870 回答