void MainWindow::MAJ_agenda() { // on fait en sorte que le jour de la semaine choisie soit le lundi while (choixSemaine.dayOfWeek() != 1 ) { // qDebug() << choixSemaine.toString(); choixSemaine = choixSemaine.addDays(-1); } QDate jour = choixSemaine; QTime debut(0, 0, 0), fin(2,0,0); unsigned int nbProgramme; for (int colonne = 0 ; colonne < 6 ; colonne ++) { // m_pTableWidget->setItem(0, 1, new QTableWidgetItem("Hello")); ui->TabAgenda->setItem(0, colonne, new QTableWidgetItem(jour.toString("d/MM/yyyy")) ); for (int ligne = 1 ; ligne < 13 ; ++ligne) { nbProgramme = Agenda::getInstance().chevaucheHoraire(jour, debut, fin); ui->TabAgenda->setItem(ligne, colonne, new QTableWidgetItem(QString::number(nbProgramme) ) ); // if (nbProgramme != 0) { // ui->TabAgenda->setItem(ligne, colonne, new QTableWidgetItem(QString::number(nbProgramme) ) ); // // ui->TabAgenda->item(ligne, colonne)->setCheckState(Qt::Checked); // } //on passe à la tranche horaire supérieure (+2H) debut = debut.addSecs(7200); fin = fin.addSecs(7200); } jour = jour.addDays(1); } // affichage du reste for(int colonne = 0 ; colonne < 6 ; ++colonne ) { } }
int credit(){ system("clear"); printf("\n\n\n\n\n"); printf("Un jeu cree par Paul P.\n"); printf("Merci a Paul C. pour son aide\n"); printf(":)\n"); getchar(); debut(); }
int main(int ac, char **av) { if (debut(ac, av[1]) == 0 && atoi(av[1]) > 0 && (av[2][0] >= 49 && av[2][0] <= 57)) { srand(time(NULL)); int a = atoi(av[2]); int b = rand()%(9+10)-9; int tabA[a], tabB[a] , tabAB[a], tabMult[a]; printf("Vecteur A:\t"); nbrAlea(a, tabA); affiche(tabA, a); printf("\n"); if (atoi(av[1]) != 2) { printf("Vecteur B:\t"); nbrAlea(a, tabB); affiche(tabB, a); printf("\n"); } if (atoi(av[1]) == 1) { printf("Vecteur A+B:\t"); somme(a, tabA, tabB, tabAB); affiche(tabAB, a); } else if (atoi(av[1]) == 2) { printf(" B: %d\nVecteur A*B:\t", b); multi(a, tabA, tabMult, b); affiche(tabMult, a); } else if (atoi(av[1]) == 3) { printf("Produit Scalaire AB:\t"); printf("%d", scal(a, tabA, tabB)); } else if (atoi(av[1]) == 4) { printf("Norme Euclidienne A.B:\t"); somme(a, tabA, tabB, tabAB); printf("%.3f", sqrt(norme(a, tabAB))); } printf("\n"); } else printf("Veuillez entrer en argument un nombre compris entre 1 et 4 suivi du nombre de coordonnee que vous voulez \n"); return (0); }
void NewGameWindow::debuterClicked() { emit debut(joueur1LE->text(),joueur2LE->text(),tempsMaxSB->value()); this->close(); }
int main(int argc, char **argv) { printf("Analyseur Lexical v1.0\n"); printf("Fichier source de Mini Project 'Compilateur'\n"); printf("Licence d'utilisation GPL : http://www.gnu.org/licenses/gpl.html \n"); printf("\n\n\n"); debut(); LEXLEME L; printf("### %s \n\n",input); do{ L = obtenir_lexeme(); if(L.type == LEXEME_TYPE.FIN) break; //printf(ANSI_COLOR_RED "%s" ANSI_COLOR_RESET "- type: %d - de: %d a: %d \n", L.valeur, L.type, L.debut, L.fin); printf(ANSI_COLOR_RED "%s" ANSI_COLOR_RESET, L.valeur); printf(" - type: "); switch(L.type){ case 1: printf( ANSI_COLOR_YELLOW "Identificateur" ANSI_COLOR_RESET ); break; case 3: printf( ANSI_COLOR_YELLOW "Nombre Entier" ANSI_COLOR_RESET ); break; case 4: printf( ANSI_COLOR_YELLOW "Nombre Decimale" ANSI_COLOR_RESET ); break; case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: case 60: case 61: case 89: printf( ANSI_COLOR_YELLOW "Mot Cle" ANSI_COLOR_RESET ); break; case 70: case 71: case 72: printf( ANSI_COLOR_YELLOW "Type de Variable" ANSI_COLOR_RESET ); break; case 90: case 91: printf( ANSI_COLOR_YELLOW "Fonction Predifinie" ANSI_COLOR_RESET ); break; case 98: printf( ANSI_COLOR_YELLOW "Fin du Line" ANSI_COLOR_RESET ); break; case 99: printf( ANSI_COLOR_YELLOW "Fin du fichier" ANSI_COLOR_RESET ); break; default: printf( ANSI_COLOR_YELLOW "Operateur" ANSI_COLOR_RESET,L.type ); } printf("- de: " ANSI_COLOR_MAGENTA "%d" ANSI_COLOR_RESET,L.debut); printf(" a: " ANSI_COLOR_MAGENTA "%d" ANSI_COLOR_RESET,L.fin); printf("\n"); }while(1); system("pause"); return 0; }
void donnerCoup(SDL_Renderer *rendu, struct listeAnimal *listeAnimaux, struct parametreAnimaux *tabParam, Personnage *personnage, Images *toutesLesImages, TTF_Font *police, ListeMonstres *listeMonstres, ParametresMonstres *tabParamMonstres, ListeBatiments *listeBat) { animationCoup(rendu, personnage, toutesLesImages, listeAnimaux, tabParam, police, listeMonstres, tabParamMonstres,listeBat); //après on regarde les dégats int distanceMax = 100; int coordPerso[2] = {(personnage->coordXA + personnage->coordXB)/2, (personnage->coordYA + personnage->coordYB)/2}; int distance = distanceMax; int vertical = 0; int coordBete[2][2]; int contactBete = False, contactAnim = False; int n1 = nombreElementListeMonstres(listeMonstres); int n2 = tailleListe(listeAnimaux); listeMonstres->cle = listeMonstres->premier; debut(listeAnimaux); int i = 0, p = 0, e = 0; while (i < n1 || p < n2) { contactBete = contactAnim = False; if (testChampsVisionMonstres(listeMonstres, personnage) == True) { coordBete[0][0] = listeMonstres->cle->valeur->coordx + LARGEUR_TILE/2; coordBete[0][1] = listeMonstres->cle->valeur->coordy + LARGEUR_TILE/2; } if (testChampsVisionAnimaux(listeAnimaux, personnage) == True) { coordBete[1][0] = listeAnimaux->cle->valeur->coordx + LARGEUR_TILE/2; coordBete[1][1] = listeAnimaux->cle->valeur->coordy + LARGEUR_TILE/2; printf("mededed\n"); } switch(personnage->orientation) { case DROITE: for(e = 0; e < 2; e++) { if (coordBete[e][0] >= coordPerso[0] && coordBete[e][0] <= coordPerso[0] + distanceMax) { if ((coordBete[e][1] >= (coordPerso[1] - distanceMax/2)) && coordBete[e][1] <= (coordPerso[1] + distanceMax/2)) { if (e == 0) contactBete = True; else contactAnim = True; } } } break; case GAUCHE: for (e = 0; e < 2; e++) { if (coordBete[e][0] >= coordPerso[0] - distanceMax && coordBete[e][0] <= coordPerso[0]) { if (coordBete[e][1] >= coordPerso[1] - distanceMax/2 && coordBete[e][1] <= coordPerso[1] + distanceMax/2) { if (e == 0) contactBete = True; else contactAnim = True; } } } break; case HAUT: for (e = 0; e < 2; e++) { if (coordBete[e][1] >= coordPerso[1] - distanceMax && coordBete[e][1] <= coordPerso[1]) { if (coordBete[e][0] >= coordPerso[0] - distanceMax/2 && coordBete[e][0] <= coordPerso[0] + distanceMax/2) { if (e == 0) contactBete = True; else contactAnim = True; } } } break; case BAS: for (e = 0; e < 2; e++) { if (coordBete[e][1] >= coordPerso[1] && coordBete[e][1] <= coordPerso[1] + distanceMax) { if (coordBete[e][0] >= coordPerso[0] - distanceMax/2 && coordBete[e][0] <= coordPerso[0] + distanceMax/2) { if (e == 0) contactBete = True; else contactAnim = True; } } } break; default: break; } if (contactBete == True || contactAnim == True) { if (retirerVieAnimauxEtMonstres(listeAnimaux, personnage, listeMonstres, contactAnim) == True) { if (contactBete == True) { gestionDropMonstres(listeMonstres, tabParamMonstres, personnage); supprimerELementListeMonstres(listeMonstres); } if (contactAnim == True) { gestionDropAnimaux(listeAnimaux, tabParam, personnage); supprimerElement(listeAnimaux); } } } deplacerCleDevantListeMonstres(listeMonstres); deplacerCleDevant(listeAnimaux); if (i < n1) i++; if (p < n2) p++; } }
int main () { //declaration des variable du programme int choix=0; liste repere_llc; repere_llc.tete=NULL; repere_llc.nb=0; chaine tab[] = {"1.Indexe le repertoire. ","2.Actualise le reprertoire.","3.Afficher la table d'indexation","4.Ajouter des fichiers au repertoire","5.Rechercher un mot dans le repertoire.","6.Rechercher 2 mot dans la meme ligne dans le repertoire.","7.Quitter le programme."}; chaine tab2[] ={"Oui","Non"}; system("color F0"); //Affichage des renseigement naicessaire au programme //le menu du programme et cela on utilisons le switch debut(); do { system("cls"); textbackground(3); textcolor(14); ///le menu printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t ***\tINDEX-PRO\t***\t\t\t\t\t\t\t\t\t\t\t "); textbackground(15); textcolor(0); choix = menuprin(tab,6,repere_llc.nb);//le menu principale switch(choix) { case 1: system("cls"); textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t\t INDEXATION DU REPERTOIRE \t\t\t\t\t\t\t\t\t\t\n "); textbackground(15); textcolor(0); system("pause"); break; case 2: system("cls"); textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t\t ACTUALISE LE REPERTOIRE \t\t\t\t\t\t\t\t\t\t\t "); textbackground(15); textcolor(0); system("pause"); break; case 3://AFFICHAGE de la table apartir du fichier index system("cls"); textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t\t AFFICHAGE DE LA TABLE D'INDEXATION \t\t\t\t\t\t\t "); textbackground(15); textcolor(0); system("pause"); break; case 4://Rechchercher un mot dans le fichier d'index system("cls"); textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t RECHERCHE DE LA PREMIER OCCURRANCE DANS LE REPERTOIRE \t\t\t\t\t\t\t "); textbackground(15); textcolor(9); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); system("pause"); break; case 5://Afficher toutes les voiture. system("cls"); textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t\t RECHERCHE DE DEUX MOTS DANS LE REPERTOIRE \t\t\t\t\t\t\t\t "); textbackground(15); printf("\n\n\t\t\t\t\t\t"); system("pause"); break; case 9://modification des information sur les vehicules break; case 7://Supprimer une voiture system("cls"); case 8:///aide et renseignement clrscr(); break; case 6:///pour quitter notre programme textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t\t ETOILE DE LA CONCESSION AUTOMOBILE\t\t\t\t\t\t\t\t "); textbackground(15); textcolor(0); int choix2; printf("\t\t\n\nVoulez-vous vraiment quitter le programme?");//confirmation pour quitter choix2=menu(tab2,2); switch (choix2) { case 1: textbackground(3); textcolor(14); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n"); printf("\t\t\t\t\t\t INDEX-PRO \t\t\t\t\t\t\t\t "); textbackground(15); textcolor(1); printf("\n\n\n\t\t\t\t\t\t MERCI D'AVOIR UTILISER NOTRE PROGRAMME.\n\n\n\n "); textcolor(9); printf("\t\t\t ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² ²²²²²²²²²² ²² ²²²²²²²²²²²²²²\n"); printf("\t\t\t ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² ²²²²²²²²²²²²²²²²²² ²²² ²²²²²²²²²²²²²²\n"); printf("\t\t\t ²²²²²²²²²²²²²²²²²²²²²²²²²²² ²²²²²²² ²²²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²²² ²²²²² ²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²² ²²²² ²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ²²²²² ²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ²² ²²²²²² ²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ² ²²²²²²²² ²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²² ²²²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²²² ²²²²²²²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²²²²²²²²²²²²²²² ²²²²²²²²²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²²²²²²²²²²²²²²² ²²²²²²²²²²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²²² ²²²²²²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²² ²²²²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ² ²²²² ²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ²² ²²²² ²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ²²²² ²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²² ²²²²²² ²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²²² ²²²²²² ²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²² ²²²²²²² ²²²²²²²²² ²²²²²² ²²²²²²\n"); printf("\t\t\t ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² ²²²² ²²²²²²²²²²²²²²²²²²²²² ²²²²²²²²²²²²²²\n"); printf("\t\t\t ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² ²²² ²²²²²²²²²²²²²²²² ²²²²²²²²²²²²²²\n\n\n\n\n "); choix=9; break; case 2: choix=0; break; } } } while (choix!=9); return 0; }
int main() { // Ressources unsigned long t_debut, t_fin; float dt, waitShoot = 0; BITMAP *buffer; int fin = 0, v = 200; Map *map; DepthList *depthList; Rect screen_pos, map_pos; Actor *joueur; // Initialisation fprintf(stderr,"Initialisation ...\n"); timeBeginPeriod(1); set_uformat(U_ASCII); set_color_depth(32); allegro_init(); install_keyboard(); install_mouse(); srand(time(NULL)); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1024, 768, 0, 0)) ERREUR("Echec du lancement du mode graphique."); buffer = create_bitmap(SCREEN_W, SCREEN_H); resman_loadSprites(); fprintf(stderr,"Chargement des ressources ...\n"); map = new_map("media/map/test1"); map_pos.x = map_pos.y = 0; map_pos.w = map->w; map_pos.h = map->h; actList = new_glist(); root = new_tree(map_pos); map_addEntities(map, actList, root); depthList = new_dlist(); screen_pos.w = SCREEN_W; screen_pos.h = SCREEN_H; // Ajout du joueur joueur = actor_addJoueur(actList, root, 500, 500); // Intro debut(); // Boucle principale fprintf(stderr,"Debut !\n"); t_debut = timeGetTime(); while(!fin) { // Gestion clavier if(key[KEY_ESC]) { fin = 1; } if(key[KEY_W]) { joueur->vit_y = -v; joueur->direction_regard = HAUT; joueur->etat = ETAT_MARCHE; } else if(key[KEY_S]) { joueur->vit_y = v; joueur->direction_regard = BAS; joueur->etat = ETAT_MARCHE; } else joueur->vit_y = 0; if(key[KEY_A]) { joueur->vit_x = -v; joueur->direction_regard = GAUCHE; joueur->etat = ETAT_MARCHE; } else if(key[KEY_D]) { joueur->vit_x = v; joueur->direction_regard = DROITE; joueur->etat = ETAT_MARCHE; } else joueur->vit_x = 0; if(joueur->vit_x != 0 && joueur->vit_y != 0) { joueur->vit_x /= sqrt(2); joueur->vit_y /= sqrt(2); } if(!key[KEY_W] && !key[KEY_D] && !key[KEY_S] && !key[KEY_A]) joueur->etat = ETAT_REPOS; if(key[KEY_Q]) { if(waitShoot <= 0) { waitShoot = .1; actor_addTree(actList, root, mouse_x + screen_pos.x, mouse_y + screen_pos.y); } } waitShoot -= dt; if(mouse_b&1) { float vx, vy, v; if(waitShoot <= 0) { waitShoot = .3; vx = mouse_x - (joueur->pos_x - screen_pos.x); vy = mouse_y - (joueur->pos_y - screen_pos.y); v = sqrt(vx*vx + vy*vy); vx = vx/v; vy = vy/v; actor_addMissile(actList, root, joueur->pos_x + vx*joueur->w*1.5, joueur->pos_y + vy*joueur->h*1.5, vx*300, vy*300); } } if(key[KEY_P]) { FILE *fd = fopen("arbres.txt", "w+"); Actor *act; glist_startIter(actList); while(!glist_endIter(actList)) { act = glist_getCurrentData(actList); if(act->type == ACT_TREE) fprintf(fd, "%d\n%d\n", (int) act->pos_x, (int) act->pos_y); glist_iter(actList); } fclose(fd); } // Double buffer clear_bitmap(buffer); render_map(buffer, map, screen_pos.x, screen_pos.y); // Mises à jour resman_updateSprites(&dt); actor_spawnMonster(actList, root); actor_ia(actList, joueur); // Deplacement glist_startIter(actList); while(!glist_endIter(actList)) { actor_update(glist_getCurrentData(actList), map_pos, map, dt); if( ((Actor*) glist_getCurrentData(actList))->deleting) { glist_remCell(actList, glist_getCurrentId(actList)); } else glist_iter(actList); } // Cadrage ecran screen_pos.x = joueur->pos_x - SCREEN_W/2; screen_pos.y = joueur->pos_y - SCREEN_H/2; // Collision tree_collisionDetection(root); // Affichage tree_update(root); dlist_getActorsFromTree(depthList, root, screen_pos); dlist_update(depthList, screen_pos); dlist_blit(depthList, buffer, screen_pos); draw_cursor(buffer); textprintf_centre_ex(buffer, font, SCREEN_W/2, 5, makecol(0, 0, 0), makecol(255, 0, 0), " Vies restantes : %d | Score : %d ", joueur->vie, score); // Rafraichissement écran vsync(); blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); // Gestion du temps t_fin = timeGetTime(); dt = ((float)t_fin - t_debut)/1000; t_debut = t_fin; // Test fin de jeu if(joueur->deleting) fin = 1; resman_freeList(); } // Game over gameover(); // Fin timeEndPeriod(1); delete_map(map); del_tree(root); del_dlist(depthList); del_glist(actList); destroy_bitmap(buffer); resman_freeSprites(); allegro_exit(); return 0; }