Allegro errors during tutorial?
Also, you should do as Hothead has asid about the return [wink]. It's a little more proper *I think*/*hope* [lol]. I'm a freshman in college now - so programming is my hobby/trade/life etc.... I hope the job market is good when I get out - if not more the reason to start my own co. if I am not already doing something [smile]
Sorry you guy are having to walk me through this but one more question:
new code:
I think my file location has problems because this should output a small picture but alas the screen is black and th program crashes.
new code:
#define USE_CONSOLE#include <allegro.h> // You must include the Allegro Header file int main(int argc, char argv[]){ BITMAP *my_pic; allegro_init(); // Initialize Allegro install_keyboard(); // Initialize keyboard routines set_color_depth(16); // Set the color depth set_gfx_mode(GFX_AUTODETECT, 640,480,0,0); // Change our graphics mode to 640x480 my_pic = load_bitmap(C:\Documents and Settings\Owner\My Documents\Visual Studio Projects\allegro\pic.bmp, NULL); // Load our picture acquire_screen(); blit(my_pic, screen, 0,0,0,0,480,360);//Draw the whole bitmap to the screen at (0,0) release_screen(); destroy_bitmap(my_pic);//Release the bitmap data readkey();// Wait untill a key is pressed return(0);// Exit with no errors}END_OF_MAIN(); // This must be called right after the closing bracket of your MAIN function. // It is Allegro specific.
I think my file location has problems because this should output a small picture but alas the screen is black and th program crashes.
I commented what I fixed:
tehred.bmp being a picture I drew myself.
That should work.
#define USE_CONSOLE#include <allegro.h> // You must include the Allegro Header file int main(int argc, char argv[]){ BITMAP *my_pic; allegro_init(); // Initialize Allegro install_keyboard(); // Initialize keyboard routines set_color_depth(16); // Set the color depth set_gfx_mode(GFX_AUTODETECT, 640,480,0,0); // Change our graphics mode to 640x480 my_pic = load_bitmap("tehred.bmp", NULL); // HERE. acquire_screen(); blit(my_pic, screen, 0,0,0,0,480,360);//Draw the whole bitmap to the screen at (0,0) release_screen(); destroy_bitmap(my_pic);//Release the bitmap data readkey();// Wait untill a key is pressed return(0);// Exit with no errors}END_OF_MAIN(); // This must be called right after the closing bracket of your MAIN function. // It is Allegro specific.
tehred.bmp being a picture I drew myself.
That should work.
Sorry man I continue to get just a black screen. While in this screen my initail keyboard input that should end program does not work and then I get the ever so lovely microsoft allegro.exe has encountered an error and needs to shut down .... would you like to send the error report.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement