   SDL_PollEvent troubles
  ive got into a bit of trouble with SDL_PollEvent, basically i have to update the events of course and i use SDL_PollEvent... now if the program enters a loop say maybe for inputting a name or something then PollEvent isnt being called and the window will freeze up.how does everyone handle this?   
  Personally I have a global variable such as bool quit which I assign to false. Then the main loop is while(!quit). For other loop I throw in another SDL_PollEvent and if they decide to quit I set quit to true so the main loop stops  and then I break from the current loop.However I'm new to this too, so there might be a better way.   ;  i did think about that, it works but erm im also sure there must be another way.   ;Quote:Original post by Bytez... now if the program enters a loop say maybe for inputting a name or something then PollEvent isnt being called and the window will freeze up.For inputting a name, you do something like this:std::string input;int main(){setup();while( SDL_PollEvent( &event ) ){    switch(event.type)    {   case SDL_KEYDOWN:   {if( event.key.keysym.sym == SDLK_RETURN )    {    setPlayersName( input );    }    else    { input += getCharFromKey( event.key.keysym.sym );    }   } }}The trick is not to go into an explicit loop. You run the "loop" by using PollEvent and then signal when you are done manually. You could have a bool indicating whether you are collection input for a string or normal game input, as a simplistic way of handling it.   ;  that helps alot thanks,   