Android 使用Libgdx加载和处理图像
我使用libgdx制作了一个安卓应用程序,但我有一个延迟问题。在玩了几个游戏之后,应用程序变得非常慢,我真的不知道为什么。 我想这可能是因为图像的加载和我何时处理它们,但我不是很确定 这是我的代码: 我有一个类单元格,在这个单元格中我加载并处理图像:Android 使用Libgdx加载和处理图像,android,image,libgdx,Android,Image,Libgdx,我使用libgdx制作了一个安卓应用程序,但我有一个延迟问题。在玩了几个游戏之后,应用程序变得非常慢,我真的不知道为什么。 我想这可能是因为图像的加载和我何时处理它们,但我不是很确定 这是我的代码: 我有一个类单元格,在这个单元格中我加载并处理图像: TextureAtlas dotsAtlas = game.getAssets().get("dots.pack", TextureAtlas.class); TextureRegion textureRegionRed = dotsAtlas.f
TextureAtlas dotsAtlas = game.getAssets().get("dots.pack", TextureAtlas.class);
TextureRegion textureRegionRed = dotsAtlas.findRegion("red");
ImageButtonStyleRed = new ImageButton.ImageButtonStyle();
ImageButtonStyleRed.imageUp = new TextureRegionDrawable(textureRegionRed);
public void disposeCell(){
dotsAtlas.dispose();
}
在类游戏屏幕中,我有:
public void dispose(){
skin.dispose();
stage.dispose();
batch.dispose();
backgroundSprite.getTexture().dispose();
generatorFont.dispose();
othersAtlas.dispose();
Cell.disposeCell();
}
我是否正确使用Atlas、textures和dispose函数来加载图像?延迟不会因为未能处理纹理而导致。这是你没有展示的东西。谢谢你的回答。你知道它是从哪里来的吗?也许是因为字体?我使用FreeTypeFontParameter、FreeTypeFontGenerator和BitmapFont。我需要把它们处理掉吗?可能有很多东西,我猜不出来。尝试LibGDX论坛并提供更多代码。