Re: [AD] al_get_path

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


On Sat April 4 2009, Elias Pschernig wrote:
> Thomas Fjellstrom wrote:
> > If we want to go all out, lets make all functions that take a path, take
> > an ALLEGRO_PATH.
>
> You mean so instead of:
>
> bitmap = al_load_bitmap(imagename);
>
> I would have to use:
>
> ALLEGRO_PATH *path = al_path_create(imagename);
> bitmap = al_load_bitmap(path);
> al_path_free(path);


Really depends on the game/app. Many times you'll have the filenames stored in a config file or some other place, and that api can provide a blah_get_path() function for you. like al_load_bitmap(al_config_get_path(item, default));


> I'd say it's a different issue. The reason I want to change
> al_path_change is the example in my previous post. You don't need to
> deal with pre-allocated buffers and maximum sizes and you save some
> code. And I don't see many use-cases where you could use the path
> returned by al_path_create without converting it to an ALLEGRO_PATH (the
> only one I can come up with is listing the directory contents, in
> fact... and it seems unlikely someone would want to do it, and trivial
> even if it's an ALLEGRO_PATH).
>
> --
> Elias Pschernig <elias@xxxxxxxxxx>
>
> ---------------------------------------------------------------------------
>---



--
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx



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