Sign in to follow this  

Allegro problems..

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() {

	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);

	return 0;

void init() {
	int depth, res;
	depth = desktop_color_depth();
	if (depth == 0) depth = 32;
	res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
	if (res != 0) {


void deinit() {

[Edited by - TheNerdTk421 on October 24, 2005 3:00:41 PM]

Share this post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this