Is there any program that lets you draw basic shapes on the screen and then gives you the coresponding java2D code to draw those inside a program. I’m planning on doing my current game using only java 2D drawing code as opposed to images but I don’t know if it’s worth it if I have to spend ages writing+testing all the drawing code.
Gimp and Inkscape (google) both output SVG files which can then be turned into Java paths. I think there is also an SVG library, but if there isn’t I’ve got a method that takes some of the Gimp’s output and converts it into a Shape.
If no existing applications do what you want, you might consider writing a simple ‘viewer’ rather than a full-blown ‘editor’.
For example, you could have a simple ASCII text file that describe the shapes you want to display (e.g., “C 0 0 10” for a circle at (0,0) with radius 10), and edit that file in Notepad (or whatever). The ‘viewer’ application would read in the text file and display the shapes on a canvas (using the same code that your game would use). If the shapes aren’t quite right, then you use Notepad to make changes, and hit the ‘reload’ button on the viewer to see what they look like.
Editing the shapes in this way wouldn’t be as nice as clicking and dragging on a proper editor, but unless you want to draw a lot of shapes then you’re probably saving a lot of development time overall.
Just a suggestion.
Simon
P.S. Since we’re talking about Java2D shapes here, you could probably define your drawings directly as Java source code, rather than inventing an ASCII text file format. You could edit a source file as usual, compile it into a class file, and have the viewer reload and execute that class file.
Batik is a full featured SVG render library. It’s pretty big and for games it’s clearly overkill.
You could check out tinyline and svgsalamander. Both are a lot smaller. However, their license is somewhat sucky.
You could also write your own SVG parser. If you only handle a few basic things it’s certainly doable.
Like I said, I’ve made code that does just that. Gimp’s output is easy to parse in Java; probably because it uses a reduced subset of the available instructions.