
		faosfbi
		
		(usa Ubuntu)
		
		Enviado em 08/03/2013 - 12:21h 
		Boa tarde Pessoal!
Estou com uma dúvida. 
Talvez mais de lógica do que de c++. 
Bom, tenho uma funcao x que fica esperando uma execucao atravez de um comando, na verdade esperando uma intervencao por um determinado botao via teclado.
Agora tenho outra funcao y que executa um relogio. 
Agora o porem, gostaria de que as duas ficassem em execucao, porem em paralelo. 
Por exemplo, que eu possa executar minha funcao x que aguarda e ao mesmo tempo a funcao y de relogio. 
O que eu tinha feito até agora é dentro da x chamdo a y, porem o relogio nao funciona pois fica aguardando uma execucao externa. 
E o contrario eu fiz tambem, chamei a y primeiro, porem ele nao fica aguardando o usuario. 
FUNCAO Y:
void Class::gameClock()
{
	
	time_t currentSecs = time( 0 ) - 10800;
	
        struct tm t;
        gmtime_r( ¤tSecs, &t );
        // Reserta clock
	t.tm_hour = 00;
	t.tm_min = 00;
	t.tm_sec = 00;
	for( ;;t.tm_sec++ )
	{
	textos.text( "hour" ).setFmt(  "%02u.%02u.%02u",  t.tm_hour , t.tm_min, t.tm_sec );
	if ( t.tm_hour == 23 && t.tm_min == 59 && t.tm_sec == 59 )
	{	t.tm_hour = 00;
		t.tm_min = 00;
		t.tm_sec = 00;
		textos.text( "hour" ).setFmt(  "%02u.%02u.%02u",  t.tm_hour , t.tm_min, t.tm_sec );
		
	}
	
	if ( t.tm_min == 59 && t.tm_sec == 59)
	{	t.tm_hour++;
		t.tm_min = 00;
		t.tm_sec = 00;
		textos.text( "hour" ).setFmt(  "%02u.%02u.%02u",  t.tm_hour , t.tm_min, t.tm_sec );
		
	}
	if ( t.tm_sec == 59 )
	{	t.tm_min++;
		t.tm_sec = 00;
		textos.text( "hour" ).setFmt(  "%02u.%02u.%02u",  t.tm_hour , t.tm_min, t.tm_sec );
		
	}
	sleep(1);
		
	}
}
FUNCAO X:
void Class::gamePause()
{
	sceneCleanup();
    	Use use;	
	reserva.restore();
  	reserva.show();
        
	textos( "hour" ).show();
	
	for( ;; )
	{
		// Aqui espera a execucao de um botao	
		Parallel
    		{
      			Call( waitKey, "doPayout" );
					
      		}
		if ( Outcome() == 1 ) 
      		{
			//sleep( 1 );
                	//theme8.stop();				
			gamePlaying();
		}
		
	}
}