Re: [AD] Allegro's DX mixer and the mixer core.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, Mar 22, 2004 at 03:00:49PM +0100, Elias Pschernig wrote:
> I assume, it's just like:
> 
> namespace allegro
> {
> #include <allegro.h>
> }

Almost. That wouldn't work because things like SCREEN_W and SCREEN_H refer
to the global variable screen... which has been placed inside a namespace.
Moreover, there are problems with the magic main that need to be worked around.
I fixed the cases I could find by removing the defines, implementing their
functionality in a namespace-friendly way and redefining them afterwards.
I think for SCREEN_H and SCREEN_W I made two static inline functions and
#defined SCREEN_H get_screen_height(), hence having the optical effect of
putting SCREEN_H within the Allegro namespace (allegro::SCREEN_H).
I also make a long list of const objects initialized with values taken from
Allegro's #defines, then redefined those #defines to point to the newly
created constant. Maybe I went overboard here though... ;)

I'll post a link for those who want to have a peek at it if I can find my code
when I get home (which is should happen some time during the week).

Evert




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/