Hello guys, someone know how to create a bitmap and attach it in the mouse?
Something like this:
https://www.youtube.com/watch?v=5uSEhm652SE&list=PL6B459AAE1642C8B4&index=12
The problem is that i have this code and i need to put the image here, but after several tests i can't do it yet...
This is the code:
Thanks
First I would try to load a bitmap and display it. This is what you need for that:
http://allegro5.org/docs/html/refman/image.html#al_init_image_addon
http://allegro5.org/docs/html/refman/graphics.html#al_load_bitmap
http://allegro5.org/docs/html/refman/graphics.html#al_draw_bitmap
Then you can try the mouse stuff:
http://allegro5.org/docs/html/refman/mouse.html
http://allegro5.org/docs/html/refman/events.html#allegro_event_mouse_axes
And you could check out the Allegro examples.
And please use <code> </code> tags
I have this problems (i put the images of my problems in this reply) scuse me for do a lot of questions but i'm new in this and i couldn't find the answers in internet, Thanks for answer me anyway
I can't see an al_draw_text call in your code, can you see in the debugger where it is? It looks like font is NULL, so something is probably not initalized. You could also look at the value of the ustr parameter, maybe it's an error message.
Mmmm... I don't know what's the problem i have the al_draw_text call, but I think is a problem with the files...
Are you calling al_draw_text, or is Allegro?
I think so... i think is the file that i include in Xcode, i don't have any problems with the other allegro functions, but i have problems with the images and with the fonts. I smell something fishy...
It's very hard to help if you don't provide any concrete information
Ok, sorry for this hahah. The error that i have tell me this:
void al_draw_tinted_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint,
float dx, float dy, int flags)
{
ASSERT(bitmap);
al_draw_tinted_bitmap_region(bitmap, tint, 0, 0,
bitmap->w, bitmap->h, dx, dy, flags); // I have an error here... Thread 8: EXC_BAD_ACCESS(code = 1, address = 0x24)
}
This is my code (i did a new):
This is all my information
You should probably check the return value from al_load_bitmap.
What? Sorry, but i didn't understand
Do something like this:
player = al_load_bitmap("resources/player.png"); if(!player){ al_show_native_message_box(NULL, NULL, NULL, "Failed loading player.png", NULL, ALLEGRO_MESSAGEBOX_ERROR); return -1; }
I did it, and i don't have any errors, but the window open and close instantly
Then you have to learn how to debug
Solved, i haven't put the complete direction in the al_load_bitmap(file); hahaha (in the tutorial that i see it isn't necessary).
Thanks for the help!
No problem