- Unlike the rest of Slick, the framework hard to understand and extend. I wanted to create my own RoundedRectangle shape but I didn't have a clue where to start.
There is already a RoundedRectangle in the package. (Just went in a couple of days ago)
- Shape classes are expensive. They gather all the points at creation-time. RoundedRectangle and Ellipse both use ArrayLists and primitive type wrappers to build the array of points. Translating and resizing shapes (such as a Circle) is costly since every point must be changed. This seems unnecessary when you only wish to use shapes for simple tasks such as Circle to Circle collision.
There is a trade off here. The reason all the points are generated at creation is for transformations to work properly. On the plus side, rendering will be faster since the points are not generated every frame.
- Shape variables are public (x, y, radius, width, etc) but changing them directly will do nothing.
They should not have been made public. I will have to fix that.
- Line doesn't implement Shape, but if it did there would be confusion with method names (setX1/setY1 etc).
setX/setY specifically say they set the left/top of the shape.(This translates the shape, not change its shape.) So there would be no confusion if Line were included in Shape since setX1/2 setY1/2 sets the points of the line.
- Certain shapes have limitations because of the point gathering. RoundedRectangle can't have it's width/height changed, for example.
Actually it can, but not from the general Shape class. It would have to be done in the RoundedRectangle specifically.(I will have to add this since it is not in there right now.) Unfortunately that does mean the points will have to regenerated.
- Shape.contains(int,int) is broken (see PolygonTest webstart).
I'll look into this.
I personally like the way AWT handles geometry. It renders points using a PathIterator that is very flexible.
I don't know how PathIterator works. I will look at it to see.