![]() |
|
draw_sprite and crash! |
Fire Wolf
Member #7,640
August 2006
|
Hey, last time I programmed something was over a year ago; I dont recall having too much of a problem. When I draw_sprite from a file, this case "small.bmp", and I execute the .exe it crashes. If I comment out draw_sprite( buffer, Newgame, 200, 200); it works fine... Whats the problem??
|
Jakub Wasilewski
Member #3,653
June 2003
![]() |
The standard advice: add checks to loading the bitmap, like: Newgame = load_bitmap(...); if (!Newgame) { allegro_message("Unable to load bitmap."); } That way, you'll get some information on why your program is crashing if it is something wrong with the path. As far as I can see, there are no other errors in your code (some bad practices, sure, but no errors per se), so there is a good chance your program just can't find/load the "small.bmp" file. --------------------------- |
ixilom
Member #7,167
April 2006
![]() |
Quote: If I comment out draw_sprite( buffer, Newgame, 200, 200); it works fine...
That tells me the small.bmp didn't load correctly, do some error checking. ___________________________________________ |
Fire Wolf
Member #7,640
August 2006
|
Whoa quick reply! The strangest thing. There is acctually nothing wrong with the program... When I exicute the .exe within Microsoft Visual C++ 6.0, it says it cant load the image. If I do it manually it works? How annoying?! |
Richard Phipps
Member #1,632
November 2001
![]() |
Then it sounds like a filepath issue.. |
Fire Wolf
Member #7,640
August 2006
|
Yes you were right, Changed my working directory. Thanks.
|
|