【问题标题】:animation of an Actor in libgdx crashes on iphonelibgdx 中 Actor 的动画在 iPhone 上崩溃
【发布时间】:2015-11-18 08:59:04
【问题描述】:

我正在使用 stackover 上的一个类来制作演员的动画,但我在物理设备上崩溃了

类AnimatedImage.java:

public class AnimatedImage extends Image
{
    protected Animation animation = null;
    private float stateTime = 0;

    public AnimatedImage(Animation animation) {
        super(animation.getKeyFrame(0));
        this.animation = animation;
    }

    @Override
    public void act(float delta)
    {
        ((TextureRegionDrawable)getDrawable()).setRegion(animation.getKeyFrame(stateTime+=delta, true));
        super.act(delta);
    }
}

create() 方法,获取帧并添加到舞台:

Array<TextureRegion> waveArrayTextureRegions = new Array<TextureRegion>();
for(int i = 1; i < 24; i++){
    waveArrayTextureRegions.add(new TextureRegion(new Texture("wave/4096/wave ("+i+").png")));
}
waveAnimation = new Animation(0.15f,waveArrayTextureRegions, Animation.PlayMode.LOOP);
waveActor = new AnimatedImage(waveAnimation );
waveActor.setWidth(Gdx.graphics.getWidth() / 1.05f);
waveActor.setHeight(Gdx.graphics.getHeight() / 1.05f);
waveActor.setPosition(0,0);
stage.addActor(waveActor);

我会添加这个类是动画演员,并且,在 Android 上没问题,但是当我通过 RoboVM 在我的 iPhone 上安装它时崩溃。 喜欢 iPhone 可能是上课或有什么问题? iPhone 模拟器上的 Additirruta 仅在我将它放在我在此类中崩溃的物理设备上时才有效。 有人可以帮帮我吗?

【问题讨论】:

  • 您能否提供有关崩溃的更多信息?回溯和/或日志会很有帮助。
  • 就像 user2016436 说我们需要更多信息。随机猜测:纹理太大或文件系统无法按您预期的方式工作。

标签: java android ios iphone libgdx


【解决方案1】:

问题是使用超过 4096 像素的纹理,而不是使用不超过 4000 x 4000 像素的图像,一切都很好。显然不支持更大的分辨率。

在我的例子中,我有一个 8000 x 1200 像素的图像,用于制作滚动背景,解决方案是从 4000 中制作两个图像,并将它们与代码结合起来,也许在一个组 (libgdx) 中。

【讨论】:

    猜你喜欢
    • 2018-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-04
    • 2017-02-08
    • 2018-01-28
    • 2017-07-24
    • 2013-11-12
    相关资源
    最近更新 更多