【发布时间】:2017-05-19 00:56:09
【问题描述】:
我的精灵不在不同的屏幕尺寸上。我该怎么办?
我的头条演员长这样:
package actors;
public class Headline extends Actor{
public static final int HEADLINE_POS_X = 450;
public static final int HEADLINE_POS_Y = 200;
private final TextureRegion textureRegion;
private Rectangle textureRegionBounds;
private OrthographicCamera cam;
public Headline(TextureRegion textureRegion,OrthographicCamera cam) {
this.textureRegion = textureRegion;
this.cam = cam;
Vector3 vec = new Vector3(Constants.HEADLINE_POS_X,Constants.HEADLINE_POS_Y,0);
cam.unproject(vec);
textureRegionBounds = new Rectangle(vec.x,vec.y , textureRegion.getRegionWidth(), textureRegion.getRegionHeight());
}
@Override
public void draw(Batch batch, float parentAlpha) {
super.draw(batch, parentAlpha);
batch.draw(textureRegion, textureRegionBounds.x, textureRegionBounds.y,800,150);
}
}
我在我的屏幕类中调用。
【问题讨论】:
-
如何创建
stage,显示该代码?