[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
So the user should destroy and recreate the screen bitmap in the user
defined callback? In one sense this is better becuase then the user
can alter screen as they please and not have any race conditions
where screen is destroyed or equal to NULL, but in another sense
maybe the user needs to know to much about screen?
I don't really understand what you're thinking of. Example?
Well in my code I was getting race conditions if I didnt do
acquire_screen/release_screen. If my drawing loop is
if ( draw ){
// RESIZE HAPPENS NOW
blit( buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h );
}
Then screen will be destroyed and blit will blit to a null object. If
the user has control over when screen is destroyed and created again,
then it could go something like:
if ( draw ){
if ( resize ){
resize = 0;
recreate_screen( new_x, new_y );
destroy_bitmap( buffer );
buffer = create_bitmap( screen->w, screen->h );
drawStuff( buffer );
}
blit( buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h );
}
PS. To be honest, I don't think resizing should be added to the
current API. Also, callback-based designs are being phased out
because of all the troubles they cause with threads.
I can see how resizing doesnt really fit with the current API, but I
think it could be worked in. callbacks wont go away till at least 4.2.0,
right? Additional functionality that uses callbacks should be able to go
into the current API.