【发布时间】:2019-11-15 08:07:24
【问题描述】:
我使用 AssetManager 来管理我的 libgdx 游戏中的资产。我有静态图像和动画。当我使用模拟器(Nexus 6,Api 29)测试游戏时它很好,但是一旦我将游戏模拟到我的真实手机(Samsung J5 2016,Api 25)它开始显示黑色矩形而不是一些动画,而是静态纹理很好。
我的动画是 800x800 像素,10 fps。
这是这种纹理的一个例子。此代码在加载屏幕中:
assetManager.load(AssetDescriptors.BONUS_TEXTURE);
这里我实例化动画,帧时间 = 0.1f。此代码在工厂中,它创建具有此类动画的对象:
animationComponent.animation = new Animation<>(GameData.FRAME_TIME,
assetManager.get(AssetDescriptors.BONUS_TEXTURE).getRegions());
我在这里画它。这是来自管理渲染的类:
batch.draw(animationComponent.animation.getKeyFrame(animationComponent.elapsedTime, true),
position.x - dimension.width / 2f, position.y - dimension.height / 2f,
dimension.width, dimension.height
);
这适用于模拟器,不适用于真实设备。请告诉我有什么问题。感谢您的帮助。
phone - player, pot and gran animationsphone - gran and pot animations
【问题讨论】:
-
添加图片以便我们为您提供帮助。
标签: java android graphics libgdx