I'm loading and drawing an image with this code:
// setting up gfx mode set_colov_conv(COLORCONV_TOTAL); // ... banana = load_bitmap("media/banana.pcx", NULL); // ... stretch_sprite(buffer, banana, 0, 0, SCREEN_W, SCREEN_H);
However, when it shows the image, all colors are plain wrong. Any idea?
You are setting color depth, setting the graphics mode, and then loading bitmaps, right?
No - first the graphics mode, then the color depth, then the color conversion, then the bitmaps loading.
Do it like this:
set_color_depth(32); if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) { abort_on_error("Couldn't set a 32 bit color resolution"); }
You should do it in the order ML said -- color depth first.
edit: beaten by Phipps
Thanks a lot!
I've tried that before, but with set_color_depth(bitmap_color_depth(screen)), which works when called AFTER the gfx initialisation, but crashes when called BEFORE the gfx initialisation.
[EDIT]
I realize now that that was completely stupid.
desktop_color_depth() gets the desktop's depth.