Allegro problems..

Started by
2 comments, last by TheNerdTk421 18 years, 6 months ago
Ok... I am using Dev-C++ and Allegro.. I am try to display a bitmap.. Ive searched the forum and I found out that my code should work.. It compiles without error.. but i get a .. We have encountered an error with this program .. error...

#include <allegro.h>

void init();
void deinit();



int main() {
	init();

	while (!key[KEY_ESC]) {
          set_window_title("Bitmap Display");
   	      BITMAP *my_pic = NULL;
          my_pic = load_bitmap("mainchar.jpg", NULL);
          blit(my_pic, screen, 0, 0, 0, 0, 480, 360);
	}

	deinit();
	return 0;
}
END_OF_MAIN();

void init() {
     
	int depth, res;
	allegro_init();
	depth = desktop_color_depth();
	if (depth == 0) depth = 32;
	set_color_depth(depth);
	res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
	if (res != 0) {
		allegro_message(allegro_error);
		exit(-1);
	}

	install_timer();
	install_keyboard();
	install_mouse();
}

void deinit() {
	clear_keybuf();
}

[Edited by - TheNerdTk421 on October 24, 2005 3:00:41 PM]
Advertisement
use the tag source instead
You're trying to load a jpg file through Allegro, while it should be a bmp file. You'll need the JPG Allegro lib. So go to Downloads/Updates and select the Devpaks.org find the devpak called JPGalleg. Then download the library and include it in your project and you're set to go.
--------------------------------A man of few words does not mean he does not have big ideas
ty

This topic is closed to new replies.

Advertisement