Jump to content
  • Advertisement
Sign in to follow this  
Sync Views

pygame + SDL question

This topic is 3795 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Inone of the projects I'm working in I'm useing python + pygame I need extra speed for some parts so wish to use a c++ dynamic libary The question is: is there a way to use the pygame SDL intstance, in c++ (So they can both draw to the same surface for example), or will I need a custom SDL wrapper DLL to allow such things?

Share this post


Link to post
Share on other sites
Advertisement
I'm pretty sure pygame is a simple SDL wrapper (except for a few of the genuinely new functions). If you write some c++ code to go along with your pygame application, and that c++ code calls some SDL functions, it should work like you want. I'm familiar with both SDL and pygame, but not with interfacing c++ and python so I'm not totally sure.

Share this post


Link to post
Share on other sites
Probabily not what your after but if you compile your python script using the -O tag. It builds optimized python code
For example..

python -O sourcecode.py

Regards,
Adam

Share this post


Link to post
Share on other sites
It's still slow for soem things, and I know that SDL_init only needs once for both, the question is how can I have a surface that is both a python object, and useable from c++ (eg how can I get a pointer from the python object to the underlaying surface)

Share this post


Link to post
Share on other sites
This depends entirely on the .dll in question. But if it's not written to handle Python objects, then it can't do anything with values from Pygame. You will have to take the values from Python, convert them into something the dll can understand, and pass that in.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!