Jump to content
  • Advertisement
Sign in to follow this  
GeorgeJennison

C++ Image Import With Allegro

This topic is 2564 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

Hi,


I have recently started using Allegro and using a character to walk around on a screen. To make the game more exciting I tried to add a background! It compiled and ran like any other program, but... It had a blank background. And. When It ran after a few seconds it displayed a message:

"Allegro.exe has stopped working. Windows is looking for solution to the problem"


Here is my code (I took away all the code involving a guy moving on a screen. So there is less code.):


#include <allegro.h>

int main()
{
allegro_init();
install_keyboard();
install_timer();
install_mouse();
install_sound( DIGI_AUTODETECT, MIDI_AUTODETECT, 0 );
set_color_depth( 8 );

set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
BITMAP *buffer = create_bitmap( 640, 480 );
BITMAP *background = NULL;
background = load_bitmap("background.bmp", NULL);



blit (background, buffer, 0, 0, 0, 0, 259, 194);


release_screen();

readkey();



return 0;
}
END_OF_MAIN();



Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!