0
在我的程序初始化过程中,我在SDL_Init()之后调用SDL_SetVideoMode()并挂起了我的程序。 当执行该程序时,如果在挂起过程中按下Ctrl-C,它将继续正常工作,并且所有工作都正常。SDL_SetVideoMode挂起进程
显然,每次都要插入SDL_SetVideoMode()并不理想!任何人对这可能是什么有什么想法?
下面是我使用的简单的测试代码:
main.cpp
int main(int argc, char* argv[])
{
Presentation* p = new Presentation(); //Presentation is used to display JPEGs
p->Initialise();
while (p->hasSlides())
{
p->DisplayNextSlide();
sleep(5);
}
return 0;
}
Presentation.cpp
Presentation::Initialise()
{
SDL_Init(SDL_INIT_VIDEO);
m_pScreen = SDL_SetVideoMode(1280,720,16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
if (!m_pScreen)
{
//error handling...
}
SDL_ShowCursor(SDL_DISABLE);
initialised = true;
}
SDL_Surface* m_pImage;
Presentation::DisplayNextSlide()
{
m_pImage = IMG_Load(filename);
if(!m_pImage)
{
//error handling...
}
SDL_BlitSurface(m_pImage,0,m_pScreen,0);
SDL_Flip(m_pScreen);
}
请显示您使用的代码。 – Giann 2010-10-25 12:52:22