Loading Bitmaps
deusliveson

Hi, I'm a beginner and I need a little help:
Using the following function under windows:
my_pict = load_bitmap("title.bmp", NULL);

I was wondering if it would be possible to load the bitmap if it was not in the same folder as my program. That is, does title.bmp always have to be in the same folder as the program, and not a nested folder? e.g. a folder called Resources with all bitmaps inside?

Thanks a lot

OICW

Welcome to A.cc, at first try to use [CODE][/CODE] tags in lowercase (see mockup) - it's easier to read code then.
The answer is yes. You can write relative path or absolute path there.

my_pict = load_bitmap("title.bmp", pal);
my_pict = load_bitmap("Foobar/title.bmp", pal);
my_pict = load_bitmap("c:/Foobar/title.bmp", pal);

The best way is to use absolute path using the path got from the function get_executable_name() or from agrv[0].

gnolam

You're confusing backslashes with forward slashes there. Backslashes need to be escaped (\\), forward slashes don't.

OICW

Hell yeah, thanks - fixed.

deusliveson

Wow thanks guys...never would have expected an answer so fast.

Evert

Fast?
It took over five minutes for the answer to be posted! ;)

Thread #585704. Printed from Allegro.cc