int main( int argc, char* args[] )
{
if( SDL_Init(SDL_INIT_EVERYTHING) < 0 )
std::cout<<"unable to init sdl";
SDL_Surface *screen = SDL_SetVideoMode(800,600,32,SDL_DOUBLEBUF);
std::cout<<"before while\n";
SDL_Event event;
while(SDL_PollEvent(&event))
{
std::cout<<"in while\n";
if(event.type == SDL_QUIT)
std::cout<<"SDL_QUIT\n";
}
std::cout<<"after while\n";
SDL_Quit();
}
由于某些未知原因,此 SDL 应用程序在 while 循环中运行 4 次后退出,而我没有杀死/关闭/等它,也没有将“SDL_QUIT”打印到标准输出。是否有一个原因?我如何解决它?