【发布时间】:2014-07-13 20:27:37
【问题描述】:
我正在使用 libGDX 1.0,但不确定它是否是错误。
我的 ImageButton 使用 TextureAtlas 在 LG OPtimus 和 HTC Desire 上正确显示。但是,在 Galaxy Tab2 上,它会完全变回原样,但仍然可以点击。
如果我从 AssetsManger 加载它的纹理,一切都可以在任何设备上正常运行。
以下是代码的相关部分:
stage = new Stage(new StretchViewport(fontCamera.viewportWidth,fontCamera.viewportHeight));
ImageButtonStyle styleButtonPlay = new ImageButtonStyle();
//this works
//textureButtonPlay = new TextureRegion(game.manager.get("data/ui/play.png",Texture.class));
//styleButtonPlay.imageUp = new TextureRegionDrawable(textureButtonPlay);
//this don't on Samsung Tab2
atlas = new TextureAtlas("data/shot/atlas.pack");
styleButtonPlay.imageUp = new TextureRegionDrawable(atlas.findRegion("ui/play"));
buttonPlay = new ImageButton(styleButtonPlay);
buttonPlay.addListener(
new ClickListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
{
startGame();
return true;
}
});
buttonPlay.setSize(80, 60);
buttonPlay.setPosition(camera.viewportWidth/2 - buttonPlay.getWidth()/2,5);
stage.addActor(buttonPlay);
我现在担心将我的所有精灵打包到单个图像上。
【问题讨论】:
标签: libgdx