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