|
draw_sprite() crash |
JMonteiro .
Member #7,296
May 2006
|
Simple as that. when i call the function draw_sprite it simply crashes my code. I've read lots of posts with that problem and i haven't found the answer.
the error is right there where it's commented ERROR. |
miran
Member #2,407
June 2002
|
Check the return value of load_bitmap. -- |
JMonteiro .
Member #7,296
May 2006
|
The arrowBOT = load_bitmap("arrow.bmp",NULL) gives 134796800. (making fprintf(stderr,"%d",arrowBOT);), i suppose it gives an integer.. |
miran
Member #2,407
June 2002
|
The return value of load_bitmap() is a BITMAP pointer. You're supposed to check if the pointer is NULL or not NULL. If it is NULL it means load_bitmap() failed. You are supposed to check that every time you call load_bitmap(). Why are you drawing your first sprite to screen when you have made a buffer to draw to? Why do you call acquire_screen()? -- |
JMonteiro .
Member #7,296
May 2006
|
I've checked it, it doesn't return NULL. I've done the acquire_screen coz it was recommended in one post i saw, initialy it wasn't there. |
miran
Member #2,407
June 2002
|
I edited my last post while you were typing. To reiterate: you must check that every bitmap loaded OK. If you get one wrong (because of wrong path, or mismatching filename case, or whatever), your code will crash. I also added a question about calling acquire_screen(). EDIT: hehe... -- |
JMonteiro .
Member #7,296
May 2006
|
Thanks man, i missed one bitmap when i changed the folder of my sources .. Thank you so much for helping me get there |
|