I m sketching on some fluid dynamics in Python. After a while, I m looking for a bit more speed, so I rewrote the actual logic in C and put up some Python bindings (using SWIG).
My problem now is that I don t how to render it in a good way. The logic is run pixel by pixel so pixels are what I want to track and render.
Python gives my a TypeError if I try to make a function in the C lib that accepts a SDL_Surface*
, I was probably a bit naive to think that PyGame mapped that easily directly to SDL. Python also seems unsure what to do if I make the C libs "init" return an SDL_Surface*
.
What is a good way to do this? It wouldn t be a problem if I would just render everything in the C lib. But I want to put on some GUI there (using Python). The C lib already keeps track of which pixels are "dirty". Should I expose that list and let Python loop through it, call a function for every dirty pixel? Seems bad, since those kind of huge loops are the exact reason I wanted to rewrite parts of the app in C.
And before anyone suggests it, boost.python is a bit heavy to install right now (since I m on Windows), so I ll just stick to SWIG for the moment (unless anyone has a clever way to install "just" boost.python?).
I m hoping for a silver bullet here. How to make a C lib, running SDL, share a render target with Python, running PyGame?