Re: [AD] Function parameter ordering conventions

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


On Wed, 2007-06-20 at 19:50 -0600, Trent Gamblin wrote:
> Victor wrote:
> > I tend to agree with Matthew.
> > 
> > I think we should change only parameter orders in places where it tends
> > to be confusing or annoying. 
>  > ...
> 
> OK, that sounds sensible. Then I think we should go with blit(src, 
> sparams, dparams) for blitting functions and draw(positions, ..., color) 
> for primitives (al_put_pixel, al_draw_line, etc).
> 

Originally, I had on the wiki:

al_draw_bitmap(x, y, bitmap)
and
al_put_pixel(x, y, color)

Then in IRC we came to the conclusion that al_draw_bitmap(bitmap, x, y)
is better, and therefore also al_put_pixel should be changed. But
myself, I completely agree that the "inconsistency" between bitmap and
color parameters makes sense - I guess we indeed should not try to
over-design function names (but also not introduce glaring
inconsistencies like in the 4.2 API).

And in this case, it's easy to say that

al_draw_bitmap(AL_BITMAP *bitmap, int x, int y)
and
al_put_pixel(int x, int y, AL_COLOR *color)

are still consistent, as AL_BITMAP* and AL_COLOR* parameters are
different things. The bitmap is a real object, so it goes first. On the
other hand, the color in drawing functions is merely an attribute,  so
it goes last.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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