Re: [AD] object oriented AL_SYSTEM

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


On 2006-08-28, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> 
> Yes, that's just what I meant :) So internal functions could just cast
> the object to what they expect (and also ASSERT on the right ->driver),
> something like:
> 
> _al_x11_line(AL_DISPLAY *display...)
> {
>    AL_ASSERT(display->driver == _al_display_x11_driver());
>    AL_DISPLAY_X11 *x11 = (AL_DISPLAY_X11 *)display;
> 
>    _al_lock_mutex(x11->xmutex);
>    XLine(x11->xdisplay, x11->xwindow, ...);
>    _al_unlock_mutex(x11->xmutex);
> }
> 
> All without the need of accessing a void * pointer (like is currently
> done e.g. with BITMAP and FONT, possible others), and _xwin (which
> already is a similar idea) would be a proper object instead of just
> grouped global variables.

I find the casting rather tedious, and you're losing out on some of C's
typechecking abilities (a problem that doesn't exist with the grouped
globals), but whatever.

Peter





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