Re: [AD] al_acknowledge_drawing_resume(ALLEGRO_DISPLAY *, void (*user_reload)(void))?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Fri, 25 May 2012 11:06:33 -0600
Trent Gamblin <trent@xxxxxxxxxx> wrote:
> 
> Here's the problem: Some of your bitmaps may depend on Allegro's and
> vice versa. Either they need each other to redraw themselves, or
> they're sub-bitmaps and you can't recreate them automatically in
> Allegro because you destroyed all of your self-managed bitmaps and
> you're reloading them after acknowledge_resume.
> 
> So it boils down to this: You may need to refresh some of your
> bitmaps before Allegro does its own, and you may need to refresh some
> after. Right now you can do it after, but not before. As I said, you
> can't just place a call before acknowledge_resume because that
> function sets up some state (makes context current etc).
> 

Can you give a short code example? Since I'm not sure I understand. In
my mind what you describe is this:

al_set_new_bitmap_flags(
    ALLEGRO_CONVERT_BITMAP |
    ALLEGRO_NO_PRESERVE_TEXTURE);
ALLEGRO_BITMAP *bitmap = al_create_bitmap(100, 100);
ALLEGRO_BITMAP *sub = al_create_sub_bitmap(bitmap, 0, 0, 50, 50);

...

case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING:
    al_acknowledge_drawing_halt(display)
    al_destroy_bitmap(sub)

...

case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING:
    sub = al_create_sub_bitmap(bitmap, 0, 0, 50, 50);

But I'm not really sure this is your problem case. And if it is,
what exactly goes wrong? Something with assigning new texture ids?




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/