RE: [AD] 4.3 graphic drivers |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thu, 2005-11-10 at 12:26 -0800, Robert Ohannessian wrote:
> I seem to remember a couple of threads on the topic, a few years back...
>
> I personally would vote for strings instead of #defines. This code
> doesn't need to be fast, since it's done just once at init time.
>
> Also, I'd like to pass an array to Allegro instead of registering the
> functions individually.
>
> For example:
>
> static const AL_VTABLE_1_0 my_vtable[] = {
> { "init", 1.0, my_init },
> { "exit", 1.0, my_exit },
> { "vsync", 1.0, my_vsync },
> { NULL, 0, NULL }
> };
>
> GFX_VTABLE *al_vtable = create_gfx_vtable();
> register_gfx_vtable_1_0(al_vtable, my_vtable);
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?
--
Elias Pschernig