是否有可能在libgdx中歪曲演员
是否有可能在libgdx
倾斜/剪切actor(图像)?
我已经发现精灵的倾斜是可能的,如这里所讨论的
演员怎么样?
这对我有用:
class SkewActor extends Actor { private TextureRegion tex; private Affine2 affine = new Affine2(); public SkewActor(TextureRegion textureRegion) { this.tex = textureRegion; } @Override public void draw(Batch batch, float parentAlpha) { Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); affine.setToTranslation(getX(), getY()); affine.shear(0.5f, 0); // <- modify skew here batch.draw(tex,getWidth(), getHeight(), affine); } }