void change_nick() { while(quit== false) { SDL_WM_SetCaption( "Change Nick", NULL); SDL_WM_SetCaption( player_nick.c_str(), NULL); message = TTF_RenderText_Solid( font, player_nick.c_str(), textColor ); apply_surface( 100, 100, message, screen); SDL_FreeSurface(message); apply_surface( 0, 0, menu, screen); apply_surface( 0, -10, version, screen); if( SDL_PollEvent( &event )) { //Checks if user wants to quit switch (event.type) { case SDL_QUIT: { quit = true; break; } case SDL_KEYDOWN: { switch( event.key.keysym.sym) { case SDLK_RETURN: return; } char ch; if ( (event.key.keysym.unicode & 0xFF80) == 0 ) { ch = event.key.keysym.unicode & 0x7F; } player_nick = player_nick + ch; } } } } }