void piscaAzul(){
  textbackground(BLACK);
  Beep(400,500);
  printxy(16, 1, "                ");
  printxy(16, 2, "                ");
  printxy(16, 3, "                ");
  printxy(16, 4, "                ");
  printxy(16, 5, "                ");
  printxy(16, 6, "                ");
  printxy(16, 7, "                ");
  wait(0.5);  
  azul();
  }
示例#2
0
/// UTILIITARY FUNCTION - Creates a new Theme a TerraLib geographical database
/// \param attTable is a copy to the Theme new attriute table being created
/// \param outputTable is the new Theme table name
/// \param whereClause is a SQL WHERE CLAUSE like string used to querie the TerraLib database
/// \param inputThemeName is a string containing the inputTheme that serves as information 
///        source for the Theme being created
/// \param view is a pointer to the TerrraLib TeView object to which Theme will be attached
/// \param layer is a pointer to the TerrraLib TeLayer object to which Theme will be attached
/// \param db is a pointer to the TerrraLib database into which the Theme will be interted
/// \param theme is a pointer to the TeTheme object being added to the geographical database
bool createNewTheme( TeTable attTable, char outputTable[], string whereClause, string inputThemeName, TeView *view, TeLayer *layer, TeDatabase *db, TeTheme *theme )
{
    TeTheme inputTheme( inputThemeName, layer); // Raian
    /// load the inputTheme properties
    // loads the existing view
    if( !db->loadTheme( &inputTheme ) )
    {
        cout << "Error: fail to load theme \"" << inputThemeName
             << db->errorMessage() << endl;
        db->close();
        return false;
    }

    view->add(theme);

    if( ! whereClause. empty() ) theme->attributeRest(whereClause);

    // Set a default visual for the geometries of the objects of the layer
    // Polygons will be set with the blue color
    TeVisual polygonVisual(TePOLYGONS);
    TeColor azul(0,0,255); // Raian: polygonVisual.color(TeColor(0,0,255));
    polygonVisual.color(azul);

    // Points will be set with the red color
    TeVisual pointVisual(TePOINTS);
    TeColor vermelho(255,0,0); // Raian: pointVisual.color(TeColor(255,0,0));
    pointVisual.color(vermelho);
    pointVisual.style(TePtTypeX);

    // Set all of the geometrical representations to be visible
    int allRep = layer->geomRep();
    theme->visibleRep(allRep);

    // Select all the attribute tables of the inputTheme
    // and add the new attribute table
    theme->setAttTables( inputTheme.attrTables() );
    theme->addThemeTable( attTable );

    // Save the theme in the database
    if (!theme->save())
    {
        cout << "Error: fail to save the theme \"" << outputTable << "\" in the database: "
             << db->errorMessage() << endl;
        db->close();
        return false;
    }

    // Build the collection of objects associated to the theme*****
    TeAttrTableVector attrsDim;
    inputTheme.getAttTables(attrsDim, TeFixedGeomDynAttr);

    string colTable = theme->collectionTable();
    string colAuxTable = theme->collectionAuxTable ();

    // ------------------------ collection
    string popule;
    popule = " INSERT INTO "+ colTable +" (c_object_id) ";
    popule += " SELECT object_id_ FROM "+ string(outputTable);
    if (!db->execute(popule))
    {
        cout << "Error: fail to build the theme collection\""<< outputTable << "\": " << db->errorMessage()
             << endl;
        db->close();
        return false;
    }
    popule = "UPDATE " + colTable;
    popule += " SET c_legend_id=0, c_legend_own=0, c_object_status=0 ";
    if (!db->execute(popule))
    {
        cout << "Error: fail to build the theme collection\""<< outputTable << "\": " << db->errorMessage()
             << endl;
        db->close();
        return false;
    }
    // ------------------------ collection aux
    if( !attrsDim.empty() && attrsDim[0].name() != "" ){
        string ins = "INSERT INTO "+ colAuxTable +" (object_id, aux0, grid_status) ";
        ins += " SELECT "+ string(outputTable) +".object_id_, "+ attrsDim[0].name() +".attr_id, 0";
        ins += " FROM "+ string(outputTable)+" LEFT JOIN "+ attrsDim[0].name() +" ON ";
        ins += string(outputTable)+".object_id_ = "+ attrsDim[0].name() +".object_id_";
        if (!db->execute(ins))
        {
            cout << "Error: fail to build the theme collection\""<< outputTable << "\": " << db->errorMessage()
                 << endl;
            db->close();
            return false;
        }
    }
    else {
        string ins = "INSERT INTO "+ colAuxTable +" (object_id, grid_status) ";
        ins += " SELECT "+ string(outputTable) +".object_id_, 0";
        ins += " FROM "+ string(outputTable);
        if (!db->execute(ins))
        {
            cout << "Error: fail to build the theme collection\""<< outputTable << "\": " << db->errorMessage()
                 << endl;
            db->close();
            return false;
        }
    };
    return true;

}
int main(){
   
    int retorno = 1, pontuacao = 0, escolha;
    printxy(16, 9, "Vamos comecar a Jogar o SUPER GENIUS?");
    printxy(16, 11, "Se acha que esta preparado aperte 1 e ENTER");
    printxy(16, 12, "Se nao outro numero e ENTER:  ");
    scanf("%i", &escolha);
    system("cls");
    while(escolha!=1){
    printxy(16, 9, "Que medo e esse? Aperta 1 e ENTER logo!  ");
    scanf("%i", &escolha);
    
    if (escolha == 1){
                            printxy(16, 11, "Boa escolha, bora jogar!");
                            wait(2.0);
                      }
    }
    system("cls");
       
 
 while(retorno==1){
 azul();
 amarelo();
 verde();
 branco();
 vermelho();
 marrom();
 azulClaro();      
 verdeClaro();
 magentaClaro();
 //setas();
 
 int nivel=1, aleatorio, cor;
 int vetor[nivel-1], i, j, sair=0;
 
 do{
     srand(time(NULL));
     aleatorio = rand() % 9; //antes era 4 
   
  vetor[nivel-1] = aleatorio;
  
  for(i=0; i<9; i++){
  wait(0.5);
   if(vetor[i]==1){
    piscaAzul();   
         }
   if(vetor[i]==2){
    piscaVerde();   
         }
   if(vetor[i]==3){
    piscaAmarelo();   
         }
   if(vetor[i]==4){
    piscaVermelho();   
         } 
   if(vetor[i]==5){
    piscaBranco();   
         }    
   if(vetor[i]==6){
    piscaMarrom();   
         }    
   if(vetor[i]==7){
    piscaAzulClaro();   
         }   
   if(vetor[i]==8){
    piscaVerdeClaro();   
         }  
   if(vetor[i]==9){
    piscaMagentaClaro();   
         }          
     }
  for(j=0; j<nivel; j++){
   textbackground(BLACK);
   printxy(36, 23, "COR : ");
   scanf("%i", &cor);
   printxy(42, 23, "   ");
   if(vetor[j]==cor){
    pontuacao = pontuacao + 10;
    gotoxy(16, 22);//antes era (4, 4)
    printf("PONTUACAO : %i", pontuacao);
    gotoxy(16, 23);//antes era (4, 5)
    printf("NIVEL     : %i", (nivel));
         }
   if(vetor[j]!= cor){
    j = nivel;
    sair = 1;   
        } 
     }     
  nivel++;
}while(sair != 1);
   system("cls");
   printxy(33, 9, "VOCE PERDEU!!!");
   gotoxy(33, 11);
   printf("PONTUACAO : %i", pontuacao);
   gotoxy(33, 12);
   printf("NIVEL     : %d", nivel);
   gotoxy(33,14);
   printf("Tecla Enter");
   getch();
   
   system("cls");
   printxy(32, 8,  "JOGAR NOVAMENTE?");
   printxy(32, 9,  "    1 - SIM");
   printxy(32, 10, "    2 - NAO");
   printxy(32, 12, "    OPCAO : ");
   scanf("%i", &retorno);
   system("cls");
   nivel = 1;
   pontuacao = 0;
  
}
  }