Re: [AD] 4.3 graphic drivers

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


On Thursday 10 November 2005 02:11 pm, Elias Pschernig wrote:
> IMO,
>
> GFX_VTABLE *al_vtable = create_gfx_vtable();
> register_gfx_vtable_1_0(al_vtable, "init", 1.0. my_init);
> register_gfx_vtable_1_0(al_vtable, "exit", 1.0. my_exit);
> register_gfx_vtable_1_0(al_vtable, "vsync", 1.0. my_vsync);
>
> would look even cleaner. Or is there an advantage of using static
> arrays?

I like this method. For one, it keeps the actual structure hidden, and thus 
need not be exposed in the API (helping for when/if Allegro becomes truely 
dynamicly loadable), and allows you to clean it up slightly, like thus:

GFX_VTABLE *al_vtable = create_gfx_vtable(1.0);
register_gfx_vtable(al_vtable, "init", my_init);
register_gfx_vtable(al_vtable, "exit", my_exit);
register_gfx_vtable(al_vtable, "vsync", my_vsync);

Though, I'm not sure if using floating point to define the version number is 
the best idea. Considering how imprecise they can be. I'd say either a 
string, or a macro that bitshifts: AL_MAKE_VERSION(1, 2, 3) == 0x00010203




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