Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Getting a bit of a problem with drawing a bitmap

Credits go to Matthew Leverton for helping out!
This thread is locked; no one can reply to it. rss feed Print
Getting a bit of a problem with drawing a bitmap
ILIKECHEEZ
Member #15,193
June 2013
avatar

Hey guys;
I as a huge pleb, have a pleblem.
I have been admiring and dabbing here and there in the Allegro API and been having a lot of fun.
Sadly, I have come across a small... Pleblem. :(
I'm getting this error (attatchment: pleblem.png)
it compiles fine, and executes but as soon as it executes it gives the problem.
the jist of the code is

#SelectExpand
1 2#include <allegro5\allegro5.h> 3#include <allegro5\allegro_native_dialog.h> 4#include <allegro5\allegro_image.h> 5int main(){ 6//bla bla bla stuff being done 7 8al_init_image_addon(); 9ALLEGRO_BITMAP *player = al_load_bitmap( "spr1.png" ); 10//more plebeian crap being done 11al_draw_bitmap(player,200,300,0); 12al_rest(10); 13al_destroy_bitmap(player); 14//The rest of the crap being killed 15return 0; 16 17}

was there an update that broke/changed something, could someone please point me in the right direction?
Thanks in advance guys!

Democracy is two wolves and a sheep voting on what's for dinner.
Liberty is a well armed sheep contesting the vote.

Matthew Leverton
Supreme Loser
January 1999
avatar

If you were to chase down the error, you'd see it lead you here:

#SelectExpand
137/* Function: al_draw_tinted_bitmap 138 */ 139void al_draw_tinted_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, 140 float dx, float dy, int flags) 141{
142 ASSERT(bitmap);
143 al_draw_tinted_bitmap_region(bitmap, tint, 0, 0, 144 bitmap->w, bitmap->h, dx, dy, flags); 145}

Your bitmap is null. The solution is somewhere in this article, probably the bit about accessing the file from the properly qualified path.

ILIKECHEEZ
Member #15,193
June 2013
avatar

Oh wow thankyou!
Thankyou so much man!
Turns out I had to put the full directory in, all the way from C:\
Anyway thanks man, I really appreciate this!

Democracy is two wolves and a sheep voting on what's for dinner.
Liberty is a well armed sheep contesting the vote.

Matthew Leverton
Supreme Loser
January 1999
avatar

Go to: