[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Mixing C and Python




--- Jan Müller <jan_mueller@gmx.de> wrote:
> Hi
> Where can I find some information about writing
> Functions and so on in C?

http://www.python.org/doc/current/ext/ext.html

> I started to write a game in C and now i want to
> port it to pygame, would it 
> be possible by first only porting the main program
> and leaving the functions 
> in C? or would it be better to do the hole thing in
> python?

The only parts it makes sense to leave in C are the
time critical parts.  Many time critical parts may be
redesigned to use a smarter algorithm at a high level.
 If your code isn't OO in design, you'll want to do
some rework to get the most out of Pythons OO features
anyway.

Overall, I recommend converting the whole thing to
Python and then emailing this list with details when
parts of it appear slow.  You will find that most of
the problems can be designed & coded around in Python
leaving you with a few small C functions for the parts
that can't be redesigned to perform better.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org