I am making a function which is creating a new bitmap with circle on it, and returning that bitmap. Something like this:
But then i have an error, because and after i called this function target is non-exciting local bitmap "temp". I thought of it, and i had an idea. Is there a function which return pointer to current bitmap? Like this:
I couldn't find that sort of function. Maybe there is other way? The sending display to function is the last help, i really wanna this function to be self-sufficient.
I call for a vote. I think we should add al_magic_function() to the api.
What does it/should it do? MAGIC!
al_set_target_bitmap(current_target_bitmap);
Not sure of I missunderstood something, but doesn't this do nothing at all?
Not sure of I missunderstood something, but doesn't this do nothing at all?
It is perhaps named poorly. Basically he is making a backup copy of the current target bitmap (pointer), modifying the target bitmap temporarily, and then restoring it to the original form. You need to do this because Allegro 5 doesn't let you specify the bitmap to draw onto in the same call as you draw. You have to first "select" a bitmap and then draw. This basically means that you either have to always select a target before you draw anywhere, or when you do change the target you have to always make a backup and restore it when you're finished.
Ah, now I see! Stupid me. I completely overlooked the decleration. Thought he did something like