How i can vanish a model or a change a background in the middle of the program.i try to disappear with SDL_FreeSurface( dot );
but i did not work.so how i can vanish a model and load another model.i try this but no success.
void clean_up()
{
SDL_FreeSurface( model );
}
while( quit == false )
{
while( SDL_PollEvent( &event ) )
{
if( event.type == SDL_MOUSEBUTTONDOWN )
{
clean_up();
}
}
}
i think that SDL_FreeSurface
just free the model in memory not in screen. and hows about
SDL1.2 is outdated please use SDL2. Anyways for the solution
After you free the surface in the function, add model = NULL;
, and blit the surface every while
loop cycle by adding a SDL_Flip(model)
at the end of your while loop, this will make your pointer point to nothing which will show nothing (aka vanish), but if you are literally talking about vanishing, you could reduce the alpha by 1 (or whatever your jazz is) in a for
loop which will make it fade out like it is vanishing,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.