Jump to content
  • Advertisement
Sign in to follow this  
TheNerdTk421

Allegro problems..

This topic is 4621 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!