| Re: [AD] to prefix or not to prefix (part 2) | 
[ Thread Index | 
Date Index
| More lists.liballeg.org/allegro-developers Archives
] 
On 29 Oct 2001, Grzegorz Adam Hankiewicz <gradha@xxxxxxxxxx> wrote:
> On Mon, Oct 29, 2001 at 05:23:09PM +1100, Peter Wang wrote:
> > >  - Get rid of (some) global variables and states. E.g. `text_mode()'
> > 
> > - *blit* and *sprite* are on my list.  The ordering of the source and
> > destination takes a while to learn, and is kinda ugly.  Unlearning
> > might be even harder...
> 
> Hi.
> 
> Just wanted to step in, say that I agree with most of the things said
> about breaking the api,
Well many things have been said about breaking the API, and mostly
contradictory ;-)
> and since we are doing such a great change,
> it could also be a good moment to take a look at all the api as a whole
> and rename the functions to have coherent naming.
> 
> If you don't get what I am talking about, please open the Allegro
> documentation section Text Output and look at the function names: some
> use underscores to separate words (text_mode), some don't (textout),
> some do but only at specific places (textprintf_centre). The ordering
> of parameters is also a nice idea too.
I think the text output functions should collapse into:
#define AL_TEXT_ALIGN_LEFT	0
#define AL_TEXT_ALIGN_CENTRE	1
#define AL_TEXT_ALIGN_RIGHT	2
void al_text_print(BITMAP *bmp, const FONT *fnt, int x, int y, 
		int align, int color, int bgcolor, const char *string);
void al_text_printf(BITMAP *bmp, const FONT *fnt, int x, int y,
		int align, int color, int bgcolor, const char *format, ...);
void al_text_print_justify(..., int x1, int x2, ...);
void al_text_printf_justify(..., int x1, int x2, ...);
Or, if I was evil:
#define AL_TEXT_ALIGN_LEFT	-1
#define AL_TEXT_ALIGN_CENTRE	-2
#define AL_TEXT_ALIGN_RIGHT	-3
Then we can get rid of the justify functions.  If `align' is >= 0,
then consider it as x2, otherwise consider it as alignment.
We could even get rid of the difference between formatted and
unformatted functions.  Ok, I'll stop now.