如何绘制一个形状,然后使用 jbox2D 和 swing 移动?
我可以绘制它,但是当我移动时,会显示旧形状。
谢谢你
public class DrawShape extends DebugDraw {
private Graphics graphics;
public DrawShape(Graphics graphics) {
super(new OBBViewportTransform());
this.graphics = graphics;
}
public void drawCircle(Vec2 center, float radius, Color3f color) {
graphics.fillOval((int) (center.x - (radius / 2)), (int) (center.y - (radius / 2)), (int) radius, (int) radius);
graphics.setColor(Color.BLACK);
}
}