[英]vanishing a model in SDL 1.2
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 );
我如何在程序中间消失模型或更改背景。我尝试使用
SDL_FreeSurface( dot );
消失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. 我认为
SDL_FreeSurface
只是在内存中而不在屏幕中释放模型。 and hows about 以及怎么样
SDL1.2 is outdated please use SDL2. SDL1.2已过时,请使用SDL2。 Anyways for the solution
无论如何寻求解决方案
After you free the surface in the function, add model = NULL;
在函数中释放曲面之后,添加
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, ,并在
while
循环的SDL_Flip(model)
添加一个SDL_Flip(model)
表面,这将使您的指针指向什么都不会显示任何东西(即消失),但是如果您实际上是在谈论消失,您可以在for
循环中将alpha值降低1(或您的爵士乐水平),使其消失,就像消失了一样,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.