Re: [AD] 4.3 graphic drivers |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] 4.3 graphic drivers
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Thu, 10 Nov 2005 16:23:43 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=F8iIoUdbj2I+GRsVwdw+8PgiLLAPdob3+l9XRmVNORYtqEVOotQUm4TiRLUSRn4We6bAe1syGfdCiJru2WQh1wKZSshzWgN4kWR5QtGMW8cXyRm3B18ntQjFt+m45217ssObGPPrl3o/mV+91X0wWU3a5a7hbkKwaxMLE/X1vhY=
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