Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am working on a game that uses simple 2d vector graphics. I want a tool that will let me visually draw things like arbitrary polygons by placing points.

A perfect tool would present a grid that I could scale larger or smaller (ie: the window is 10 units across or the window is 20 units across). It would let me draw a polygon on this grid, and will tell me, simply, the coordinates of each point.

It would be great if this tool could then export a file format that was something like

0, 5
3, -2
0, 0
-3, -2

For bonus points, it would be great to be able to assign other attributes to each point. In the end, this will get passed to OpenGL, so things like color and opacity could possibly be used.

share|improve this question

1 Answer 1

Well, Flash, Illustrator and so on allow you to draw vectors while snapping to a grid. You could then export as SVG and do some processing on the SVG data, but be warned, I've heard it said that the SVG specification is nightmare.

Why not write your own? Seems really straightforward to do, from what you've said. Set up your onscreen grid according to the scaling the user has specified. Do some simple math, on mouse release, to see what the closest point on the on-screen grid is, and snap to that. I would write this in something like Adobe AIR (Flash for desktop) since Flash supports easy-to-use vector drawing in code. While normal Flash can't access the file system, AIR can, so you can just write your CSV-like file to disk. You could write each vertex as something like

[x, y, (metadata1, metadata2, ...)]

...to elaborate on your example.

You could even use a bit of Flex for the UI part of it, if you wanted to go that far. Sounds like a good FOSS project in fact -- although I don't doubt there are similar things out there, somewhere.

share|improve this answer
1  
You could also use a "image map" editor (for drawing/editing HTML image maps), since they simply generate a list of vertex coordinates. There's no way to add metadata there however. –  bummzack Aug 21 '11 at 12:00
    
Yep good point bummzack. –  Nick Wiggill Aug 21 '11 at 12:22
    
Yeah, I have been considering doing this. Though I will probably use Python and Pyglet, since I am already working in that. –  Mike Cooper Aug 21 '11 at 15:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.