diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index cf8da57dbfb..8efc678ee09 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -20,6 +20,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack; import com.badlogic.gdx.utils.Clipboard; @@ -892,6 +893,23 @@ public class Forge implements ApplicationListener { endClip(); } + public void setRotateTransform(float originX, float originY, float rotation) { + batch.end(); + float dx = adjustX(originX); + float dy = adjustY(originY, 0); + batch.getTransformMatrix().translate(dx, dy, 0); + batch.getTransformMatrix().rotate(Vector3.Z, rotation); + batch.getTransformMatrix().translate(-dx, -dy, 0); + batch.begin(); + //shapeRenderer.setTransformMatrix(matrix); + } + + public void clearTransform() { + batch.end(); + batch.getTransformMatrix().idt(); + batch.begin(); + } + public void drawRotatedImage(Texture image, float x, float y, float w, float h, float originX, float originY, float rotation) { batch.draw(image, adjustX(x), adjustY(y, h), originX - x, h - (originY - y), w, h, 1, 1, rotation, 0, 0, image.getWidth(), image.getHeight(), false, false); } diff --git a/forge-gui-mobile/src/forge/toolbox/FCardPanel.java b/forge-gui-mobile/src/forge/toolbox/FCardPanel.java index 40dcdb53d22..2344354143d 100644 --- a/forge-gui-mobile/src/forge/toolbox/FCardPanel.java +++ b/forge-gui-mobile/src/forge/toolbox/FCardPanel.java @@ -86,10 +86,13 @@ public class FCardPanel extends FDisplayObject { Texture image = ImageCache.getImage(card); if (tapped) { float edgeOffset = w / 2f; - g.drawRotatedImage(image, x, y, w, h, x + edgeOffset, y + h - edgeOffset, tappedAngle); + g.setRotateTransform(x + edgeOffset, y + h - edgeOffset, tappedAngle); } - else { - g.drawImage(image, x, y, w, h); + + g.drawImage(image, x, y, w, h); + + if (tapped) { + g.clearTransform(); } } }