Is Python and pygame a good way to learn SDL?

Not picture Not · Oct 26, 2008 · Viewed 22.6k times · Source

If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?

Answer

taw picture taw · Jan 11, 2009

Python+PyGame is a really great idea for learning SDL.

I wrote a somewhat popular game that way. Python/PyGame seems much more advanced than SDL bindings to any other language, and one huge advantage compared to C++ is that don't have to compile code, and with some simple hacking can even modify a running program, and see the feedback live. It makes a huge huge difference - like using a GUI vector graphics program vs writing SVG in a text editor. Unfortunately you don't get this out of the box, because you need to adapt your program a bit to see it.

As for other advantages of PyGame, jrpg ran with very small changes on Linux, Windows, and OSX. I had to do some tweaks to fullscreen mode switching, and double buffering as there were some differences between OSes, but no recompilation was ever necessary. If you have any problems you can get good stack trace and debug your problems live, that's not really possible with C++ once you get a memory corruption or a segfault.

I don't really know how easy or how hard would it be to mix C++ and Python for your SDL games. I think it cannot be too hard, as PyGame is a pretty straightforward but very nicely made wrapper for SDL, and Python/C++ mixing is supposed to be easy enough.