Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem With Allegro

Started by _mICROCHIP_ Jan 31, 2010 at 5:32 AM 1 replies 1.4k views
Original Post
_mICROCHIP_
_mICROCHIP_
Hi all guys Hi copied this code from Game Programming All in One but i have a problem to run it... I put the immage that i want to see into the screen into the the same folder of the project that i'm making but my program doesn't see it.I took the immage from google and i changed its extension in PCX Help me please :-( Here the code : #include int main(void) { char *filename = "ciao.pcx"; BITMAP *image; int ret; allegro_init(); install_keyboard(); set_color_depth(32); ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (ret != 0) { allegro_message(allegro_error); return 1; } //load the image file image = load_bitmap(filename, NULL); if (!image) { allegro_message("Error loading %­s", filename); return 1; } //display the image blit(image, screen, 0, 0, 0, 0, 320, 240); //done drawing—delete bitmap from memory destroy_bitmap(image); //display video mode information textprintf_ex(screen,font,0,0,1,-1,"%dx%d",SCREEN_W,SCREEN_H); //wait for keypress while (!keypressed()); //exit program allegro_exit(); return 0; } END_OF_MAIN()
mich4elp
mich4elp
Use the source tags for your code, it will make it easier for others to read.
Also, when you say "my program doesn't see it", do you mean that your program runs, but nothing is shown? Do you get an error?
It could also be that getting an image from google and just changing the file extension to .pcx does not make it into a proper .pcx file.
Why don't you try loading a .bmp file?
_mICROCHIP_
_mICROCHIP_
Quote:
Original post by mich4elp
It could also be that getting an image from google and just changing the file extension to .pcx does not make it into a proper .pcx file.
Why don't you try loading a .bmp file?


Yes it is.I fix the problem
Thx man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.