| Re: [AD] New graphics API, take 2 |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
In reply to Shawn Hargreaves <shargreaves@xxxxxxxxxx>:
>It would actually be really handy (and would have been in
>the past for some drivers) if there was a way to attach
>multiple independent bits of custom data to a bitmap.
Rather than having lots of different structures, why not have one
structure with a pointer to a variable-sized chunk of data:
struct AL_BITMAP {
AL_BITMAP_VTABLE* vtable;
int w, h;
int cl, cr, ct, cp;
/* all usual bitmap stuff */
struct AL_BITMAP_CHUNK* chunk;
};
struct AL_BITMAP_CHUNK {
int id; /* from DAT_ID() equivalent */
void* dat;
};
and have chunk be a dynamically-allocated array, terminated with a { 0,
0 } element. Even if it ever needs to be resized, you could use
realloc().
Bye for now,
--
Laurence Withers, lwithers@xxxxxxxxxx
http://www.lwithers.demon.co.uk/
Attachment:
signature.asc
Description: PGP signature
| Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |