So I've got this class that handles a BufferedImage:
public class Entity {
private BufferedImage sprite;
private final AffineTransform at;
public Entity(String imageFileName, int x, int y) {
sprite = null;
try {
this.sprite = ImageIO.read(new File(imageFileName));
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
at = new AffineTransform();
at.translate(x, y);
}
public void draw(Graphics2D g) {
g.drawImage(sprite, at, null);
}
public void rotate(double radians) {
at.rotate(radians);
}
public void move(int dx, int dy) {
at.translate(dx, dy);
}
...
However, the rotate
function isn't behaving how I want it to; I want it just to rotate the image in place, keeping all other data about the image the same. I've seen the other questions on this topic, but they don't have the same question I do.
Thank you!