I got some problem with al_create_bitmap. When I try to create bitmap, bitmap is still NULL. No matter of size I can´t create it. Can someone help me please.
Is it null or did you fall for the dreaded extra semicolon?
if (Image == NULL);{
Ok that was my fault but still when I try to draw this bitmap the console tell me this: Assertion failed: bitmap != dest && bitmap != dest->parent, file C:/dev/allegro_winpkg/universal/allegro/src/bitmap_draw.c, line 34
What that mean or better how can I solve it.
Allegro 5 doesn't let you draw a bitmap unto itself. Call al_set_target_bitmap to change the drawing target.
You mean like I must set target to "Image" and then back to backbuffer?
yes. You have to tell allegro which bitmap you are drawing to. And it can't be itself.
// 1. preserve the current target bitmap ALLEGRO_BITMAP* target = al_get_target_bitmap(); // 2. set your bitmap as target bitmap al_set_target_bitmap(my_bitmap); // 3. draw to my_bitmap // 4. restore original target bitmap al_set_target_bitmap(target); // 5. draw my_bitmap to whatever target was
Ok now it don´t crash and seem to work but it drawing nothing after pixel is inserted in.
What's the new code after fix. Also, did you set the bitmap as target before drawing pixel?
Yes I change target
I can't follow your code very well. Don't mix logic and drawing. Look up the event loop on the wiki.
https://github.com/liballeg/allegro_wiki/wiki/Allegro-Vivace-%E2%80%93-Basic-game-structure
Ok I will check it thanks for help before. I figured it out where was problem. I was putting one format of color to bitmap with another.