Allegro.cc - Online Community
Post Reply

Allegro.cc Forums » Allegro Development » Does al_load_bitmap_f work

rss feed Print
Does al_load_bitmap_f work
Niunio
Member #1,975
March 2002
avatar

Initially I thought it was a problem with Allegro.pas, but I did some testing with C and I have the same problem: it returns NULL.

I'm using Linux Xubuntu 16.04.3 updated and latest Allegro 5.2.3.

To reproduce the problem, get the ex_bitmap.c example and just add this at the beginning:

  ALLEGRO_FILE *lFile = NULL;

Then search the line "bitmap = al_load_bitmap(filename);" and change it:

/*
    bitmap = al_load_bitmap(filename);
 */
    lFile = al_fopen (filename, "r");
    bitmap = al_load_bitmap_f (lFile, filename);
    al_fclose (lFile);

AFAIK it should work, but it didn't. Debugging with GDB it says in function al_load_bitmap_flags_f that "h" is NULL. Didn't look deeper.

-----------------
Current projects: Allegro.pas | MinGRo

Bruce Perry
Member #270
April 2000

Judging by a quick look at the source, the string argument should no longer be the filename, but the result of al_identify_bitmap or al_identify_bitmap_f - possibly the file extension but I'm not sure. Does that help?

[EDIT]
Yep, canonical extension with dot - see here.

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Niunio
Member #1,975
March 2002
avatar

Did a test (in Pascal) and didn't work. I can't do the test in C now but I will.

[edit]
Tested in C and it works. Then I find the problem with Pascal: the destination buffer pointer wasn't used properly. Now it works. :)
[/edit]

Anyway, the problem seems that Mr. Silly Me didn't read the documentation. ::)

-----------------
Current projects: Allegro.pas | MinGRo

Post Reply
Go to: