Re: [AD] SF.net SVN: alleg:[12053] allegro/branches/4.9/examples/nihgui.cpp

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


On 2009-04-10, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> tjaden@xxxxxxxxxx wrote:
> > Revision: 12053
> >           http://alleg.svn.sourceforge.net/alleg/?rev=12053&view=rev
> > Author:   tjaden
> > Date:     2009-04-10 04:20:27 +0000 (Fri, 10 Apr 2009)
> > 
> > Log Message:
> > -----------
> > Fix the TextEntry widget which drew the text incorrectly when the
> > cursor_pos==0, as al_draw_text() treats the zero end parameter specially.
> > Can't say it's ideal...
> 
> Maybe (start, count) instead, with count == -1 meaning until end of 
> string? Again a special case, but maybe less likely to run into problems 
> (and the same change should be made then to al_ref_ustr, not good having 
> different ways to specify sub-strings throughout the API).

I think we should take the substring parameters off al_draw_text() and
expose a version of it that takes a ustr instead.  If you need to draw a
substring you can wrap it in a ustr quite easily.

    void al_draw_text(const ALLEGRO_FONT *font, float x, float y, int flags,
       const char *text);

    void al_draw_ustr(const ALLEGRO_FONT *font, float x, float y, int flags,
       const ALLEGRO_USTR *text);

The people who didn't like the count parameter should be happy as well
(that includes me after the count parameter became start/end).

Peter





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