Jump to content
  • Advertisement
Sign in to follow this  
K0K0NUT_h3lmut

Hmmm, I'm sure it's obvious.

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

Why won't this work. Every time I run this it gives me a "AllegroReflectivebubbleBlit.exe has encountered a problem and needs to close. We are sorry for the inconvenience," error. Is it because I cant blit from an image- to an the same image? Would it help if I made a pointer to that image instead? Allegro supports jpg right? #include <allegro.h> int main() { char *filename = "bubbles.jpg"; int colordepth = 32; BITMAP *image; int ret; int x; int y; x = rand() % SCREEN_W; y = rand() % SCREEN_H; allegro_init(); install_keyboard(); //initialize random # seed srand(time(NULL)); set_color_depth(colordepth); 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, SCREEN_W, SCREEN_H); blit(image, image, 0, 0, 0, 0, x, y); //end program allegro_exit(); } END_OF_MAIN();

Share this post


Link to post
Share on other sites
Advertisement
As of 4.0.3, the latest stable version and the one I use, Allegro doesn't support loading JPG images. (Although it's not that hard to write your own module to extend it, using the IJG's library. Though there are restrictions on the IJG stuff, I think.) So that's probably what's causing the crash.

Share this post


Link to post
Share on other sites
Then trying to load a .jpg will definitely cause a problem :)
In fact, in looking at the docs for the latest beta it still doesn't support (out of the box) loading JPEGs, and it's probably a safe bet it never has either. The easy thing to do would be convert your image to a BMP; the harder (but perhaps more satisfying...at least it would be for me...) would be to write a JPEG loading module. Then again, perhaps someone else already has; it may be worth a Google.

Oh, I also realized that you're calling allegro_exit() at the end when you don't need to. allegro_init() automatically sets Allegro up to exit when the program closes. This probably is not your problem, however.

Cheers,
Twilight Dragon

Share this post


Link to post
Share on other sites
Try using a normal BMP and see if that fixes it.

I use SDL myself, which only has native BMP support, but this may hold true for Allegro as well.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!