[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] PyGame and SVG



I was thinking about UIs today and recalled a post by Brad Wardel about the UI in Galactic Civilizations. He mentioned how it would look pretty much the same regardless of the resolution one runs the game at, due to the use of SVG. Presumably, the UI is designed as vector drawings and at runtime rendered to a texture whose size depends upon the current screen resolution.

I thought that this would be a great idea for PyGame, but then I found that the only implementation of SVG that exists for PyGame actually uses Cairo. Personally, I think that using Cairo within PyGame is, at best, suboptimum. What you end up with is a whole lot of redundant library that is doing exactly nothing. It would be much better to have a implementation with relatively atomic dependencies.

Fortunately, after a bit of googling I discovered SDL_svg. It appears to require only libxml-2.0 and libSDL. Perfect. It also has a very small API. Perfect. After a bit more research I managed to create my own Python bindings using Pyrex. Take a look:

http://code.google.com/p/pygame-svg/

-Daniel