adonthell-devel
[Top][All Lists]
Advanced

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

RE: [Adonthell-devel] Python question


From: Mike Avery
Subject: RE: [Adonthell-devel] Python question
Date: Wed, 21 May 2003 08:54:32 -0700

> You will probably want to make that structure known to Python 
> by adding
> it to the py_adonthell.i file. Usually, it'll be enough to 
> add #include
> "yourclass.h" respectively %include "yourclass.h" at the 
> proper places.
> (You'll see where what needs to go).

So I define the structure in manager.h and it will get included in the
shadow manager class when I use
Manager = adonthel.manager().  I can then interact with the class as I would
in C++, only using python syntax, correct?

 
> Afterwards, upon running make, SWIG will create a wrapper for your
> structure and the matching Python shadow class.
> 
> When calling your get_char_snapshot from the manager, you'll get that
> shadow class, which encapsulates your original C++ object. It'll have
> all the attributes your C++ class has and can be used in the same way.
> And of course, your C++ object will reflect the changes made to that 
> shadow object.
> 
> Btw, that shadow class ends up being defined in modules/adonthell.py.
> See there for more info about what is going on.

Ah, OK.  I see how it works now.  I was looking at stuff in src/adonthell
and src/tools/pydonthell and I wasn't seeing how things were tied together.
It's clearer now, thanks.

I may be getting ahead of myself here.  I think I had better look at the
character class first.  It seems to be a skeleton right now.  Working on
get_char_snapshot() without first having a working character class seems
backwards :)

I think we need the character, item and inv classes sorted out before we can
really be productive in building the manager.  Your prototype looks great!
I think we end up doing work trying to fudge the missing functionality in
the related classes.

I'm going to switch modes and look at having the C++ and Pyton character
classes reflect the current status of what we want.  Is that OK?

Mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]