From cfd8c64452615525c7336ec26c794e26e20460be Mon Sep 17 00:00:00 2001 From: Cwik Pierre Date: Fri, 1 Jul 2016 22:35:49 +0200 Subject: [PATCH] fin centipede --- projets/Centipede/Makefile | 13 ------------- projets/Centipede/centipede | Bin 37536 -> 0 bytes projets/Centipede/progprinc.c | 273 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- projets/Centipede/progprinc.c~ | 224 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- projets/Centipede/progprinc.o | Bin 25512 -> 0 bytes projets/Centipede/scores.txt | 1 - projets/Graphique/Makefile | 29 ----------------------------- projets/Graphique/libgraph.a | Bin 31830 -> 0 bytes projets/Graphique/libgraph.c | 180 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ projets/Graphique/libgraph.h | 33 --------------------------------- projets/Graphique/libgraph.o | Bin 31456 -> 0 bytes projets/Liste/.directory | 6 ------ projets/Liste/Makefile | 29 ----------------------------- projets/Liste/libFile.c | 55 ------------------------------------------------------- projets/Liste/libFile.h | 15 --------------- projets/Liste/libFile.o | Bin 5816 -> 0 bytes projets/Liste/libListe.a | Bin 6032 -> 0 bytes projets/Lutins/game_over.bmp | Bin 199554 -> 0 bytes projets/Lutins/invader_bombe.bmp | Bin 1042 -> 0 bytes projets/Lutins/invader_bouclier.bmp | Bin 7514 -> 0 bytes projets/Lutins/invader_canon.bmp | Bin 3818 -> 0 bytes projets/Lutins/invader_canon_ferraille.bmp | Bin 4610 -> 0 bytes projets/Lutins/invader_missile.bmp | Bin 578 -> 0 bytes projets/Lutins/invader_monstre1_1.bmp | Bin 3422 -> 0 bytes projets/Lutins/invader_monstre1_2.bmp | Bin 3422 -> 0 bytes projets/Lutins/invader_monstre2_1.bmp | Bin 3950 -> 0 bytes projets/Lutins/invader_monstre2_2.bmp | Bin 3950 -> 0 bytes projets/Lutins/invader_monstre3_1.bmp | Bin 3950 -> 0 bytes projets/Lutins/invader_monstre3_2.bmp | Bin 3950 -> 0 bytes projets/Lutins/invader_monstre_bouillie.bmp | Bin 4610 -> 0 bytes projets/Lutins/invader_ovni.bmp | Bin 4826 -> 0 bytes projets/Lutins/level1.bmp | Bin 750054 -> 0 bytes projets/Lutins/level2.bmp | Bin 750054 -> 0 bytes projets/Lutins/level3.bmp | Bin 750054 -> 0 bytes projets/Lutins/level_cleared.PNG | Bin 15715 -> 0 bytes projets/Lutins/level_cleared.bmp | Bin 109422 -> 0 bytes projets/Lutins/millepatte_champi.bmp | Bin 5738 -> 0 bytes projets/Lutins/millepatte_corps_bas.bmp | Bin 6906 -> 0 bytes projets/Lutins/millepatte_corps_droite.bmp | Bin 6890 -> 0 bytes projets/Lutins/millepatte_corps_gauche.bmp | Bin 6890 -> 0 bytes projets/Lutins/millepatte_corps_haut.bmp | Bin 6906 -> 0 bytes projets/Lutins/millepatte_tete_bas.bmp | Bin 6906 -> 0 bytes projets/Lutins/millepatte_tete_droite.bmp | Bin 6906 -> 0 bytes projets/Lutins/millepatte_tete_gauche.bmp | Bin 6906 -> 0 bytes projets/Lutins/millepatte_tete_haut.bmp | Bin 6906 -> 0 bytes projets/Lutins/youwin.bmp | Bin 119478 -> 0 bytes projets/Makefile | 24 ------------------------ projets/Testliste/Makefile | 12 ------------ projets/Testliste/projet | Bin 10368 -> 0 bytes projets/Testliste/test.c | 27 --------------------------- projets/Testliste/test.o | Bin 3904 -> 0 bytes projets/projetsfile/Centipede/Makefile | 13 +++++++++++++ projets/projetsfile/Centipede/centipede | Bin 0 -> 43186 bytes projets/projetsfile/Centipede/progprinc.c | 301 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetsfile/Centipede/progprinc.c~ | 301 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetsfile/Centipede/progprinc.o | Bin 0 -> 30608 bytes projets/projetsfile/Centipede/scores.txt | 1 + projets/projetsfile/Graphique/Makefile | 29 +++++++++++++++++++++++++++++ projets/projetsfile/Graphique/libgraph.a | Bin 0 -> 31830 bytes projets/projetsfile/Graphique/libgraph.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetsfile/Graphique/libgraph.h | 33 +++++++++++++++++++++++++++++++++ projets/projetsfile/Graphique/libgraph.o | Bin 0 -> 31456 bytes projets/projetsfile/Liste/.directory | 6 ++++++ projets/projetsfile/Liste/Makefile | 29 +++++++++++++++++++++++++++++ projets/projetsfile/Liste/libFile.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetsfile/Liste/libFile.h | 15 +++++++++++++++ projets/projetsfile/Liste/libFile.o | Bin 0 -> 5816 bytes projets/projetsfile/Liste/libListe.a | Bin 0 -> 6032 bytes projets/projetsfile/Lutins/game_over.bmp | Bin 0 -> 199554 bytes projets/projetsfile/Lutins/invader_bombe.bmp | Bin 0 -> 1042 bytes projets/projetsfile/Lutins/invader_bouclier.bmp | Bin 0 -> 7514 bytes projets/projetsfile/Lutins/invader_canon.bmp | Bin 0 -> 3818 bytes projets/projetsfile/Lutins/invader_canon_ferraille.bmp | Bin 0 -> 4610 bytes projets/projetsfile/Lutins/invader_missile.bmp | Bin 0 -> 578 bytes projets/projetsfile/Lutins/invader_monstre1_1.bmp | Bin 0 -> 3422 bytes projets/projetsfile/Lutins/invader_monstre1_2.bmp | Bin 0 -> 3422 bytes projets/projetsfile/Lutins/invader_monstre2_1.bmp | Bin 0 -> 3950 bytes projets/projetsfile/Lutins/invader_monstre2_2.bmp | Bin 0 -> 3950 bytes projets/projetsfile/Lutins/invader_monstre3_1.bmp | Bin 0 -> 3950 bytes projets/projetsfile/Lutins/invader_monstre3_2.bmp | Bin 0 -> 3950 bytes projets/projetsfile/Lutins/invader_monstre_bouillie.bmp | Bin 0 -> 4610 bytes projets/projetsfile/Lutins/invader_ovni.bmp | Bin 0 -> 4826 bytes projets/projetsfile/Lutins/level1.bmp | Bin 0 -> 750054 bytes projets/projetsfile/Lutins/level2.bmp | Bin 0 -> 750054 bytes projets/projetsfile/Lutins/level3.bmp | Bin 0 -> 750054 bytes projets/projetsfile/Lutins/level_cleared.PNG | Bin 0 -> 15715 bytes projets/projetsfile/Lutins/level_cleared.bmp | Bin 0 -> 109422 bytes projets/projetsfile/Lutins/millepatte_champi.bmp | Bin 0 -> 5738 bytes projets/projetsfile/Lutins/millepatte_corps_bas.bmp | Bin 0 -> 6906 bytes projets/projetsfile/Lutins/millepatte_corps_droite.bmp | Bin 0 -> 6890 bytes projets/projetsfile/Lutins/millepatte_corps_gauche.bmp | Bin 0 -> 6890 bytes projets/projetsfile/Lutins/millepatte_corps_haut.bmp | Bin 0 -> 6906 bytes projets/projetsfile/Lutins/millepatte_tete_bas.bmp | Bin 0 -> 6906 bytes projets/projetsfile/Lutins/millepatte_tete_droite.bmp | Bin 0 -> 6906 bytes projets/projetsfile/Lutins/millepatte_tete_gauche.bmp | Bin 0 -> 6906 bytes projets/projetsfile/Lutins/millepatte_tete_haut.bmp | Bin 0 -> 6906 bytes projets/projetsfile/Lutins/youwin.bmp | Bin 0 -> 119478 bytes projets/projetsfile/Makefile | 24 ++++++++++++++++++++++++ projets/projetsfile/Testliste/Makefile | 12 ++++++++++++ projets/projetsfile/Testliste/projet | Bin 0 -> 10368 bytes projets/projetsfile/Testliste/test.c | 27 +++++++++++++++++++++++++++ projets/projetsfile/Testliste/test.o | Bin 0 -> 3904 bytes projets/projetsfile/scores.txt | Bin 0 -> 51 bytes projets/projetslistechainee/Centipede/Makefile | 13 +++++++++++++ projets/projetslistechainee/Centipede/centipede | Bin 0 -> 44891 bytes projets/projetslistechainee/Centipede/progprinc.c | 302 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Centipede/progprinc.c~ | 304 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Centipede/progprinc.o | Bin 0 -> 30968 bytes projets/projetslistechainee/Graphique/Makefile | 29 +++++++++++++++++++++++++++++ projets/projetslistechainee/Graphique/libgraph.a | Bin 0 -> 31830 bytes projets/projetslistechainee/Graphique/libgraph.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Graphique/libgraph.h | 33 +++++++++++++++++++++++++++++++++ projets/projetslistechainee/Graphique/libgraph.o | Bin 0 -> 31456 bytes projets/projetslistechainee/Liste/.directory | 6 ++++++ projets/projetslistechainee/Liste/Makefile | 29 +++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/a.out | Bin 0 -> 9147 bytes projets/projetslistechainee/Liste/libFile.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/libFile.c~ | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/libFile.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/libFile.h~ | 45 +++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/libFile.o | Bin 0 -> 10592 bytes projets/projetslistechainee/Liste/libListe.a | Bin 0 -> 20134 bytes projets/projetslistechainee/Liste/listechainee.c | 278 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/listechainee.c~ | 275 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projets/projetslistechainee/Liste/listechainee.o | Bin 0 -> 8928 bytes projets/projetslistechainee/Lutins/game_over.bmp | Bin 0 -> 199554 bytes projets/projetslistechainee/Lutins/invader_bombe.bmp | Bin 0 -> 1042 bytes projets/projetslistechainee/Lutins/invader_bouclier.bmp | Bin 0 -> 7514 bytes projets/projetslistechainee/Lutins/invader_canon.bmp | Bin 0 -> 3818 bytes projets/projetslistechainee/Lutins/invader_canon_ferraille.bmp | Bin 0 -> 4610 bytes projets/projetslistechainee/Lutins/invader_missile.bmp | Bin 0 -> 578 bytes projets/projetslistechainee/Lutins/invader_monstre1_1.bmp | Bin 0 -> 3422 bytes projets/projetslistechainee/Lutins/invader_monstre1_2.bmp | Bin 0 -> 3422 bytes projets/projetslistechainee/Lutins/invader_monstre2_1.bmp | Bin 0 -> 3950 bytes projets/projetslistechainee/Lutins/invader_monstre2_2.bmp | Bin 0 -> 3950 bytes projets/projetslistechainee/Lutins/invader_monstre3_1.bmp | Bin 0 -> 3950 bytes projets/projetslistechainee/Lutins/invader_monstre3_2.bmp | Bin 0 -> 3950 bytes projets/projetslistechainee/Lutins/invader_monstre_bouillie.bmp | Bin 0 -> 4610 bytes projets/projetslistechainee/Lutins/invader_ovni.bmp | Bin 0 -> 4826 bytes projets/projetslistechainee/Lutins/level1.bmp | Bin 0 -> 750054 bytes projets/projetslistechainee/Lutins/level2.bmp | Bin 0 -> 750054 bytes projets/projetslistechainee/Lutins/level3.bmp | Bin 0 -> 750054 bytes projets/projetslistechainee/Lutins/level_cleared.PNG | Bin 0 -> 15715 bytes projets/projetslistechainee/Lutins/level_cleared.bmp | Bin 0 -> 109422 bytes projets/projetslistechainee/Lutins/millepatte_champi.bmp | Bin 0 -> 5738 bytes projets/projetslistechainee/Lutins/millepatte_corps_bas.bmp | Bin 0 -> 6906 bytes projets/projetslistechainee/Lutins/millepatte_corps_droite.bmp | Bin 0 -> 6890 bytes projets/projetslistechainee/Lutins/millepatte_corps_gauche.bmp | Bin 0 -> 6890 bytes projets/projetslistechainee/Lutins/millepatte_corps_haut.bmp | Bin 0 -> 6906 bytes projets/projetslistechainee/Lutins/millepatte_tete_bas.bmp | Bin 0 -> 6906 bytes projets/projetslistechainee/Lutins/millepatte_tete_droite.bmp | Bin 0 -> 6906 bytes projets/projetslistechainee/Lutins/millepatte_tete_gauche.bmp | Bin 0 -> 6906 bytes projets/projetslistechainee/Lutins/millepatte_tete_haut.bmp | Bin 0 -> 6906 bytes projets/projetslistechainee/Lutins/youwin.bmp | Bin 0 -> 119478 bytes projets/projetslistechainee/Makefile | 24 ++++++++++++++++++++++++ projets/projetslistechainee/Testliste/Makefile | 12 ++++++++++++ projets/projetslistechainee/Testliste/projet | Bin 0 -> 13832 bytes projets/projetslistechainee/Testliste/test.c | 27 +++++++++++++++++++++++++++ projets/projetslistechainee/Testliste/test.o | Bin 0 -> 3904 bytes projets/projetslistechainee/scores.txt | Bin 0 -> 204 bytes 160 files changed, 3012 insertions(+), 921 deletions(-) delete mode 100644 projets/Centipede/Makefile delete mode 100755 projets/Centipede/centipede delete mode 100644 projets/Centipede/progprinc.c delete mode 100644 projets/Centipede/progprinc.c~ delete mode 100644 projets/Centipede/progprinc.o delete mode 100644 projets/Centipede/scores.txt delete mode 100644 projets/Graphique/Makefile delete mode 100644 projets/Graphique/libgraph.a delete mode 100644 projets/Graphique/libgraph.c delete mode 100644 projets/Graphique/libgraph.h delete mode 100644 projets/Graphique/libgraph.o delete mode 100644 projets/Liste/.directory delete mode 100644 projets/Liste/Makefile delete mode 100644 projets/Liste/libFile.c delete mode 100644 projets/Liste/libFile.h delete mode 100644 projets/Liste/libFile.o delete mode 100644 projets/Liste/libListe.a delete mode 100644 projets/Lutins/game_over.bmp delete mode 100644 projets/Lutins/invader_bombe.bmp delete mode 100644 projets/Lutins/invader_bouclier.bmp delete mode 100644 projets/Lutins/invader_canon.bmp delete mode 100644 projets/Lutins/invader_canon_ferraille.bmp delete mode 100644 projets/Lutins/invader_missile.bmp delete mode 100644 projets/Lutins/invader_monstre1_1.bmp delete mode 100644 projets/Lutins/invader_monstre1_2.bmp delete mode 100644 projets/Lutins/invader_monstre2_1.bmp delete mode 100644 projets/Lutins/invader_monstre2_2.bmp delete mode 100644 projets/Lutins/invader_monstre3_1.bmp delete mode 100644 projets/Lutins/invader_monstre3_2.bmp delete mode 100644 projets/Lutins/invader_monstre_bouillie.bmp delete mode 100644 projets/Lutins/invader_ovni.bmp delete mode 100644 projets/Lutins/level1.bmp delete mode 100644 projets/Lutins/level2.bmp delete mode 100644 projets/Lutins/level3.bmp delete mode 100644 projets/Lutins/level_cleared.PNG delete mode 100644 projets/Lutins/level_cleared.bmp delete mode 100644 projets/Lutins/millepatte_champi.bmp delete mode 100644 projets/Lutins/millepatte_corps_bas.bmp delete mode 100644 projets/Lutins/millepatte_corps_droite.bmp delete mode 100644 projets/Lutins/millepatte_corps_gauche.bmp delete mode 100644 projets/Lutins/millepatte_corps_haut.bmp delete mode 100644 projets/Lutins/millepatte_tete_bas.bmp delete mode 100644 projets/Lutins/millepatte_tete_droite.bmp delete mode 100644 projets/Lutins/millepatte_tete_gauche.bmp delete mode 100644 projets/Lutins/millepatte_tete_haut.bmp delete mode 100644 projets/Lutins/youwin.bmp delete mode 100644 projets/Makefile delete mode 100644 projets/Testliste/Makefile delete mode 100644 projets/Testliste/projet delete mode 100644 projets/Testliste/test.c delete mode 100644 projets/Testliste/test.o create mode 100644 projets/projetsfile/Centipede/Makefile create mode 100755 projets/projetsfile/Centipede/centipede create mode 100644 projets/projetsfile/Centipede/progprinc.c create mode 100644 projets/projetsfile/Centipede/progprinc.c~ create mode 100644 projets/projetsfile/Centipede/progprinc.o create mode 100644 projets/projetsfile/Centipede/scores.txt create mode 100644 projets/projetsfile/Graphique/Makefile create mode 100644 projets/projetsfile/Graphique/libgraph.a create mode 100644 projets/projetsfile/Graphique/libgraph.c create mode 100644 projets/projetsfile/Graphique/libgraph.h create mode 100644 projets/projetsfile/Graphique/libgraph.o create mode 100644 projets/projetsfile/Liste/.directory create mode 100644 projets/projetsfile/Liste/Makefile create mode 100644 projets/projetsfile/Liste/libFile.c create mode 100644 projets/projetsfile/Liste/libFile.h create mode 100644 projets/projetsfile/Liste/libFile.o create mode 100644 projets/projetsfile/Liste/libListe.a create mode 100644 projets/projetsfile/Lutins/game_over.bmp create mode 100644 projets/projetsfile/Lutins/invader_bombe.bmp create mode 100644 projets/projetsfile/Lutins/invader_bouclier.bmp create mode 100644 projets/projetsfile/Lutins/invader_canon.bmp create mode 100644 projets/projetsfile/Lutins/invader_canon_ferraille.bmp create mode 100644 projets/projetsfile/Lutins/invader_missile.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre1_1.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre1_2.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre2_1.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre2_2.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre3_1.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre3_2.bmp create mode 100644 projets/projetsfile/Lutins/invader_monstre_bouillie.bmp create mode 100644 projets/projetsfile/Lutins/invader_ovni.bmp create mode 100644 projets/projetsfile/Lutins/level1.bmp create mode 100644 projets/projetsfile/Lutins/level2.bmp create mode 100644 projets/projetsfile/Lutins/level3.bmp create mode 100644 projets/projetsfile/Lutins/level_cleared.PNG create mode 100644 projets/projetsfile/Lutins/level_cleared.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_champi.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_corps_bas.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_corps_droite.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_corps_gauche.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_corps_haut.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_tete_bas.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_tete_droite.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_tete_gauche.bmp create mode 100644 projets/projetsfile/Lutins/millepatte_tete_haut.bmp create mode 100644 projets/projetsfile/Lutins/youwin.bmp create mode 100644 projets/projetsfile/Makefile create mode 100644 projets/projetsfile/Testliste/Makefile create mode 100644 projets/projetsfile/Testliste/projet create mode 100644 projets/projetsfile/Testliste/test.c create mode 100644 projets/projetsfile/Testliste/test.o create mode 100644 projets/projetsfile/scores.txt create mode 100644 projets/projetslistechainee/Centipede/Makefile create mode 100755 projets/projetslistechainee/Centipede/centipede create mode 100644 projets/projetslistechainee/Centipede/progprinc.c create mode 100644 projets/projetslistechainee/Centipede/progprinc.c~ create mode 100644 projets/projetslistechainee/Centipede/progprinc.o create mode 100644 projets/projetslistechainee/Graphique/Makefile create mode 100644 projets/projetslistechainee/Graphique/libgraph.a create mode 100644 projets/projetslistechainee/Graphique/libgraph.c create mode 100644 projets/projetslistechainee/Graphique/libgraph.h create mode 100644 projets/projetslistechainee/Graphique/libgraph.o create mode 100644 projets/projetslistechainee/Liste/.directory create mode 100644 projets/projetslistechainee/Liste/Makefile create mode 100755 projets/projetslistechainee/Liste/a.out create mode 100644 projets/projetslistechainee/Liste/libFile.c create mode 100644 projets/projetslistechainee/Liste/libFile.c~ create mode 100644 projets/projetslistechainee/Liste/libFile.h create mode 100644 projets/projetslistechainee/Liste/libFile.h~ create mode 100644 projets/projetslistechainee/Liste/libFile.o create mode 100644 projets/projetslistechainee/Liste/libListe.a create mode 100644 projets/projetslistechainee/Liste/listechainee.c create mode 100644 projets/projetslistechainee/Liste/listechainee.c~ create mode 100644 projets/projetslistechainee/Liste/listechainee.o create mode 100644 projets/projetslistechainee/Lutins/game_over.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_bombe.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_bouclier.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_canon.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_canon_ferraille.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_missile.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre1_1.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre1_2.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre2_1.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre2_2.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre3_1.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre3_2.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_monstre_bouillie.bmp create mode 100644 projets/projetslistechainee/Lutins/invader_ovni.bmp create mode 100644 projets/projetslistechainee/Lutins/level1.bmp create mode 100644 projets/projetslistechainee/Lutins/level2.bmp create mode 100644 projets/projetslistechainee/Lutins/level3.bmp create mode 100644 projets/projetslistechainee/Lutins/level_cleared.PNG create mode 100644 projets/projetslistechainee/Lutins/level_cleared.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_champi.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_corps_bas.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_corps_droite.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_corps_gauche.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_corps_haut.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_tete_bas.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_tete_droite.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_tete_gauche.bmp create mode 100644 projets/projetslistechainee/Lutins/millepatte_tete_haut.bmp create mode 100644 projets/projetslistechainee/Lutins/youwin.bmp create mode 100644 projets/projetslistechainee/Makefile create mode 100644 projets/projetslistechainee/Testliste/Makefile create mode 100644 projets/projetslistechainee/Testliste/projet create mode 100644 projets/projetslistechainee/Testliste/test.c create mode 100644 projets/projetslistechainee/Testliste/test.o create mode 100644 projets/projetslistechainee/scores.txt diff --git a/projets/Centipede/Makefile b/projets/Centipede/Makefile deleted file mode 100644 index 6b28b6e..0000000 --- a/projets/Centipede/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -SOURCES = $(wildcard *.c) -OBJETS = $(SOURCES:.c=.o) -BIBLIOTHEQUES = -L ../Liste -lListe -L ../Graphique -lgraph -EXECUTABLE = centipede -CFLAGS += -Wall -I ../Liste -I ../Graphique - -all: $(EXECUTABLE) - -$(EXECUTABLE): $(OBJETS) - $(CC) -o $@ $^ $(BIBLIOTHEQUES) -lSDL - -clean: - rm -rf $(EXECUTABLE) *.o diff --git a/projets/Centipede/centipede b/projets/Centipede/centipede deleted file mode 100755 index ebc97cc..0000000 Binary files a/projets/Centipede/centipede and /dev/null differ diff --git a/projets/Centipede/progprinc.c b/projets/Centipede/progprinc.c deleted file mode 100644 index 2a610f2..0000000 --- a/projets/Centipede/progprinc.c +++ /dev/null @@ -1,273 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#define MAX_ELEMENTS 50 - -typedef struct{ - char pseudo[MAX_ELEMENTS]; - int scorefait; -}scorejoueur; - - -typedef struct { - int x; - int y; -}position; - - -typedef struct { - position contenu[MAX_ELEMENTS]; - int nombre; - } liste_poly; - - -void creationgrille(){ -int i; -for(i = 0 ; i < 20; i++) - { - rectanglePlein(i*50,0,1,1000,5); //pose de la grille - rectanglePlein(0,i*50,1000,1,5); - } } - - -void affichage(element_t e) -{ - position *p = e; - printf("%d %d \n", p->x, p->y); -} - - - - -void creerchampignons(int n,liste_poly *muschrooms,int champi){ - position poschampi; - int i,w; - int test=0; - for(w=0;wcontenu[i].x == poschampi.x && muschrooms->contenu[i].y == poschampi.y ) test=1; - } - if((poschampi.y > 570 || poschampi.y < 430) && test==0) - { - muschrooms->contenu[muschrooms->nombre++]=poschampi; - afficherLutin(champi,(muschrooms->contenu[w].x)+1,(muschrooms->contenu[w].y)+6); - } - else w--; - test = 0; - } -} - - -void creationcenti(liste_t *l, int Teted, int Corpsd){ - int i; - position *pos; - position posmillepatte; - for(i=0; i<4; i++) - { - posmillepatte.x = (300 + 50*i); - posmillepatte.y = 500; - enfiler(l,&posmillepatte,sizeof(position)); - } - //affichage des corpsd du centipede - for(i=0; i<4; i++) - { - pos = enieme(i,l); - afficherLutin(Corpsd,pos->x,pos->y); - } - - posmillepatte.x = 500; - posmillepatte.y = 500; - enfiler(l,&posmillepatte,sizeof(position)); //affichage de la tete du Centipède - pos = enieme(4,l); - afficherLutin(Teted,pos->x,pos->y); -} - -int main() { - SDL_keysym* detail; - srand(time(NULL)); - char touche; - unsigned char bas; - int largeur = 1000; - int hauteur = 1000; - char *name; - char *titre = "Le Centipede"; - scorejoueur resultat; - liste_poly testscore; - position *pos; - position posmillepatte; - - - int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); - int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); - int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); - int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); - int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); - int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); - int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); - int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); - int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); - int gameover = chargerLutin("Lutins/game_over.bmp",0); - int level1 = chargerLutin("Lutins/level1.bmp",0); - int level2 = chargerLutin("Lutins/level2.bmp",0); - int level3 = chargerLutin("Lutins/level3.bmp",0); - int levelclr = chargerLutin("Lutins/level_cleared.bmp",0); - int youwin = chargerLutin("Lutins/youwin.bmp",0); - int Tete; - int Corps; - int i; - int abs, ord, obstacle, couleur,level=1,speed=5000,total=0,nombrechampis=6, s; - - if(champi<0 || Teted<0 || Teteg<0 || Teteh <0 || Teteb<0 || Corpsg<0 || Corpsd<0 || Corpsh<0 || Corpsb<0 || gameover<0 || level1<0 || level2<0 || level3<0 || levelclr<0 || youwin<0){ printf("Image pas là\n"); exit(-1); } - - printf("joueur !! quel est votre pseudo ? :"); - scanf("%s",&name); - resultat.nom = name; - creerSurface(largeur,hauteur,titre); - majSurface(); - int gomme = creerLutin(0,0,50,50,-1); - -while(level<=3) { - - queue = 0; - liste_poly muschrooms={.nombre=0}; - liste_t listecenti={NULL,0,0}; - int w,t,compteur=0,allonge; - - rectanglePlein(0,0,1000,1000,1); - - if(level==1) { afficherLutin(level1,250,250); majSurface(); sleep(1); } - if(level==2) { afficherLutin(level2,250,250); majSurface(); sleep(1); } - if(level==3) { afficherLutin(level3,250,250); majSurface(); sleep(1); } - - rectanglePlein(0,0,1000,1000,-1); - - creationcenti(&listecenti,Teted,Corpsd); - - creerchampignons(nombrechampis,&muschrooms,champi); - - majSurface(); - - attendreEvenement(); - - s = 0; - t = 0; - - while(1){ - for(i=0;isym==SDLK_RIGHT) t=0; - if(detail->sym==SDLK_UP) t=1; - if(detail->sym==SDLK_LEFT) t=2; - if(detail->sym==SDLK_DOWN) t=3; - } - - usleep(1); - } - if((t==0 && s!=2) || s==0) { abs=50; ord=0; Tete = Teted; Corps = Corpsd; s=0; } - if((t==1 && s!=3) || s==1) { abs=0; ord=(-50); Tete = Teteh; Corps = Corpsh; s=1; } - if((t==2 && s!=0) || s==2) { abs=-50; ord=0; Tete = Teteg; Corps = Corpsg; s=2; } - if((t==3 && s!=1) || s==3) { abs=0; ord=50; Tete = Teteb; Corps = Corpsb; s=3; } - - pos = dernier(&listecenti); - posmillepatte.x = pos->x+abs; - posmillepatte.y = pos->y+ord; - if(posmillepatte.x==1000 || posmillepatte.y==1000 || posmillepatte.x==-50 || posmillepatte.y==-50) - { - afficherLutin(gameover,250,433); - majSurface(); - sleep(5); - break; - } - - majSurface(); - couleur = couleurPixel(posmillepatte.x+25,posmillepatte.y+25); - if(couleur!=1) obstacle = 1; - else obstacle = 0; - allonge = 0; - - if(obstacle==1){ - for(w=0;wx,pos->y); - afficherLutin(Corps,(pos->x),pos->y); - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); - afficherLutin(Tete,posmillepatte.x,posmillepatte.y); - compteur++; - } - else { - afficherLutin(gameover,250,433); - majSurface(); - sleep(5); - break; - } - - } - - if(obstacle==0){ - afficherLutin(gomme,pos->x,pos->y); - afficherLutin(Corps,(pos->x),pos->y); - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); - afficherLutin(Tete,posmillepatte.x,posmillepatte.y); - pos = premier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - defiler(&listecenti); - } - majSurface(); - - if(compteur==nombrechampis) break; - - if(touche=='a') - { - fermerSurface(); //condition d'arret - return 0; - } - } - - - total = total+compteur; - if(compteur != nombrechampis) break; - if(level==3) { afficherLutin(youwin,204,400); majSurface(); sleep(3); } - else { afficherLutin(levelclr,304,454); majSurface(); sleep(3); } - compteur = 0; - nombrechampis = nombrechampis+3; - speed = speed/2.2; - level++; - -} - printf("votre score est de %d\n",total); - resultat.scorefait = total; - - FILE *fichier = NULL; - fichier = fopen("scores.txt",r+); - - if(fichier==NULL) { printf("\n le fichier n'a pas plus etre ouvert"); fermerSurface(); } - - else{ - - testscore->contenu[testscore->nombre++]=fread; - - - - - - } - - - fermerSurface(); - fclose(fichier); - return 0; -} - - \ No newline at end of file diff --git a/projets/Centipede/progprinc.c~ b/projets/Centipede/progprinc.c~ deleted file mode 100644 index a834742..0000000 --- a/projets/Centipede/progprinc.c~ +++ /dev/null @@ -1,224 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#define MAX_ELEMENTS 50 - -typedef struct { - int x; - int y; -}position; - -typedef struct { - position contenu[MAX_ELEMENTS]; - int nombre; - } liste_champi; - -void affichage(element_t e) -{ - position *p = e; - printf("%d %d \n", p->x, p->y); -} - - -int main() { - SDL_keysym* detail; - srand(time(NULL)); - char touche; - unsigned char bas; - int largeur = 1000; - int hauteur = 1000; - liste_champi muschrooms={.nombre=0}; - liste_t listecenti={NULL,0,0}; - int h,w,l,i,t; - int s=10; - char *titre = "Le Centipède"; - - - int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); - int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); - int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); - int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); - int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); - int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); - int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); - int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); - int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); - int gameover = chargerLutin("Lutins/game_over.bmp",0); - - if(champi<0){ printf("Champi pas là\n"); exit(-1); } - tailleLutin(champi,&l,&h); - - - position *pos; - position poschampi; - position posmillepatte; - - creerSurface(largeur,hauteur,titre); - - int x = 300; - int y = 500; - - for(i=0; i<4; i++) - { - posmillepatte.x = (x + 50*i); - posmillepatte.y = y; - enfiler(&listecenti,&posmillepatte,sizeof(position)); - } - //affichage des corpsd du centipede - for(i=0; i<4; i++) - { - pos = enieme(i,&listecenti); - afficherLutin(Corpsd,pos->x,pos->y); - } - - posmillepatte.x = (x+200); - posmillepatte.y = y; - enfiler(&listecenti,&posmillepatte,sizeof(position)); //affichage de la tete du Centipède - pos = enieme(4, &listecenti); - afficherLutin(Teted,pos->x,pos->y); - - for(i = 0 ; i < 20; i++) - { - rectanglePlein(i*50,0,1,1000,5); //pose de la grille - rectanglePlein(0,i*50,1000,1,5); - } - - for(w=0;w<10;w++) { - poschampi.x = (rand()%20)*50; //fixe coordonnées des champignons - poschampi.y = (rand()%20)*50; - if(poschampi.y > 570 || poschampi.y < 430) { - muschrooms.contenu[muschrooms.nombre++]=poschampi; } - else w--; - } - - printf("%d %d \n",l,h); - - for(w=0;w<10;w++){ - afficherLutin(champi,(muschrooms.contenu[w].x)+1,(muschrooms.contenu[w].y)+6); - }//affiche les champis - majSurface(); - - int gomme = creerLutin(0,0,50,50,0); - majSurface(); - - - - while(1){ - if(lireTouche(&bas,&touche,(void **)&detail) && bas==1) { - - if(detail->sym==SDLK_RIGHT) t=0; - if(detail->sym==SDLK_UP) t=1; - if(detail->sym==SDLK_LEFT) t=2; - if(detail->sym==SDLK_DOWN) t=3; } - - usleep(500000); - - if((t==0 && s!=2) || s==0) { - printf("dans le droite\n"); - pos = premier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - defiler(&listecenti); - - pos = dernier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - afficherLutin(Corpsd,(pos->x),pos->y); - posmillepatte.x = pos->x+50; - posmillepatte.y = pos->y; - if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ - afficherLutin(gameover,400,400); - majSurface(); - sleep(5); - fermerSurface(); - } - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); - afficherLutin(Teted,posmillepatte.x,posmillepatte.y); - majSurface(); - s=0; - } - - if((t==1 && s!=3) || s==1) { - printf("dans le haut\n"); - pos = premier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - defiler(&listecenti); - - pos = dernier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - afficherLutin(Corpsh,(pos->x),pos->y); - posmillepatte.x = pos->x; - posmillepatte.y = pos->y-50; - if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ - afficherLutin(gameover,400,400); - majSurface(); - sleep(5); - fermerSurface(); - } - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); - afficherLutin(Teteh,posmillepatte.x,posmillepatte.y); - majSurface(); - s=1; - } - - if((t==2 && s!=0) || s==2) { - printf("dans le gauche\n"); - pos = premier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - defiler(&listecenti); - - pos = dernier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - afficherLutin(Corpsg,(pos->x),pos->y); - posmillepatte.x = pos->x-50; - posmillepatte.y = pos->y; - if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ - afficherLutin(gameover,400,400); - majSurface(); - sleep(5); - fermerSurface(); - } - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); - afficherLutin(Teteg,posmillepatte.x,posmillepatte.y); - majSurface(); - s=2; - } - - if((t==3 && s!=1) || s==3) { - printf("dans le bas\n"); - pos = premier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - defiler(&listecenti); - - pos = dernier(&listecenti); - afficherLutin(gomme,pos->x,pos->y); - afficherLutin(Corpsb,(pos->x),pos->y); - posmillepatte.x = pos->x; - posmillepatte.y = pos->y+50; - if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ - afficherLutin(gameover,400,400); - majSurface(); - sleep(5); - fermerSurface(); - } - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); - afficherLutin(Teteb,posmillepatte.x,posmillepatte.y); - majSurface(); - s=3; - } - - if(touche=='a') - { - fermerSurface(); //condition d'arret - return 0; - - } -} - - - return 0; -} - - diff --git a/projets/Centipede/progprinc.o b/projets/Centipede/progprinc.o deleted file mode 100644 index 83ba189..0000000 Binary files a/projets/Centipede/progprinc.o and /dev/null differ diff --git a/projets/Centipede/scores.txt b/projets/Centipede/scores.txt deleted file mode 100644 index 8d1c8b6..0000000 --- a/projets/Centipede/scores.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/projets/Graphique/Makefile b/projets/Graphique/Makefile deleted file mode 100644 index 5791d72..0000000 --- a/projets/Graphique/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Makefile pour la bibliotheque graphique -# - -SOURCES = $(wildcard *.c) -OBJETS = $(SOURCES:.c=.o) -CIBLE = libgraph.a - -# -# Nom de la cible principale -# - -all: $(CIBLE) - -# -# Cible de nettoyage -# - -clean: - rm -f core *.o $(CIBLE) - -# -# Dependances pour la bibliotheque -# - -$(CIBLE): $(OBJETS) - $(AR) rs $@ $? - -$(CIBLE:.a=).o: $(CIBLE:.a=).c $(CIBLE:.a=).h diff --git a/projets/Graphique/libgraph.a b/projets/Graphique/libgraph.a deleted file mode 100644 index 2789297..0000000 Binary files a/projets/Graphique/libgraph.a and /dev/null differ diff --git a/projets/Graphique/libgraph.c b/projets/Graphique/libgraph.c deleted file mode 100644 index bff8b0f..0000000 --- a/projets/Graphique/libgraph.c +++ /dev/null @@ -1,180 +0,0 @@ -/**** Bibliotheque graphique ****/ - -/** Fichiers d'inclusion **/ - -#include - -#include "libgraph.h" - -/** Types **/ - -typedef struct { int r,v,b; } couleur; - -/** Constantes **/ - -#define BITS_PAR_PIXEL 32 - -static const couleur couleurs[]={ - {255,255,255}, - {0,0,0}, - {255,0,0}, - {0,255,0}, - {0,0,255}, - {255,105,180}, - {150,150,150}, - {-1,-1,-1} - }; - -/** Variables globales **/ - -static SDL_Surface *surface; - -/** Fonctions **/ - -/* Initialisation de la surface dessinable */ - -unsigned char creerSurface(int largeur,int hauteur,char *titre){ -SDL_Init(SDL_INIT_VIDEO); -SDL_WM_SetCaption(titre,titre); -surface=SDL_SetVideoMode(largeur,hauteur,BITS_PAR_PIXEL,SDL_DOUBLEBUF); -return (surface!=NULL); -} - -/* Fermeture de la surface dessinable */ - -void fermerSurface(void){ -if(surface!=NULL) SDL_FreeSurface(surface); -SDL_Quit(); -} - -/* Creation d'une couleur */ - -static int creerCouleur(int ncouleur){ -couleur c=couleurs[ncouleur]; -return SDL_MapRGB(surface->format,c.r,c.v,c.b); -} - -/* Dessin d'un rectangle plein */ - -void rectanglePlein(int x,int y,int l,int h,int c){ -SDL_Rect rectangle={x,y,l,h}; -SDL_FillRect(surface,&rectangle,creerCouleur(c)); -//SDL_Flip(surface); -} - -/* Manipulation de lutins */ - -static SDL_Surface *lutins[MAX_LUTINS]; -static int lutins_nb=0; - -static void configurerLutin(SDL_Surface *lutin,int ncouleur){ -couleur c=couleurs[ncouleur]; -int fond=SDL_MapRGB(lutin->format,c.r,c.v,c.b); -SDL_SetColorKey(lutin,SDL_SRCCOLORKEY|SDL_RLEACCEL,fond); -} - -int chargerLutin(char *fichier,int couleur){ -if(lutins_nb>=MAX_LUTINS) return -2; -SDL_Surface *lutin=SDL_LoadBMP(fichier); -if(lutin!=NULL){ - lutins[lutins_nb++]=lutin; - if(couleur>=0) configurerLutin(lutin,couleur); - return lutins_nb-1; - } -return -1; -} - -void afficherLutin(int lutin,int x,int y){ -SDL_Rect position; -position.x=x; -position.y=y; -SDL_BlitSurface(lutins[lutin],NULL,surface,&position); -} - -int creerLutin(int x,int y,int largeur,int hauteur,int couleur){ -if(lutins_nb>=MAX_LUTINS) return -2; -int rmask,gmask,bmask,amask; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN -rmask=0xff000000; gmask=0x00ff0000; bmask=0x0000ff00; amask=0x000000ff; -#else -rmask=0x000000ff; gmask=0x0000ff00; bmask=0x00ff0000; amask=0xff000000; -#endif -if(couleur<0) amask=0x00000000; -SDL_Surface *lutin=SDL_CreateRGBSurface(0,largeur,hauteur,BITS_PAR_PIXEL,rmask,gmask,bmask,amask); -SDL_Rect fenetre; -fenetre.x=x; -fenetre.y=y; -fenetre.h=hauteur; -fenetre.w=largeur; -SDL_BlitSurface(surface,&fenetre,lutin,NULL); -lutins[lutins_nb++]=lutin; -if(couleur>=0) configurerLutin(lutin,couleur); -return lutins_nb-1; -} - -void tailleLutin(int lutin,int *largeur,int *hauteur){ -*largeur=lutins[lutin]->w; -*hauteur=lutins[lutin]->h; -} - -int sauverLutin(int lutin,char *nom){ return SDL_SaveBMP(lutins[lutin],nom); } - -/* Manipulation de copie de surface en BMP */ - -int sauverSurface(char *fichier){ return SDL_SaveBMP(surface,fichier); } - -unsigned char chargerSurface(char *fichier){ -SDL_Surface *image=SDL_LoadBMP(fichier); -if(image!=NULL){ - SDL_BlitSurface(image,NULL,surface,NULL); - SDL_Flip(surface); - } -return (image!=NULL); -} - -void majSurface(void){ SDL_Flip(surface); } - -/* Trouver la couleur d'un pixel */ - -int couleurPixel(int x,int y){ -int bpp=surface->format->BytesPerPixel; -Uint32 *p=(Uint32 *)(surface->pixels+y*surface->pitch+x*bpp); -Uint8 r,v,b; -SDL_GetRGB(*p,surface->format,&r,&v,&b); -int i=0; -while(1){ - if(couleurs[i].r<0) break; - if(r==couleurs[i].r && v==couleurs[i].v && b==couleurs[i].b) break; - i++; - } -if(couleurs[i].r<0) return -1; else return i; -} - -/* Fonction de traitement des événements */ - -unsigned char lireTouche(unsigned char *bas,char *touche,void **detail){ -static SDL_keysym _detail; -SDL_Event event; -while(SDL_PollEvent(&event)){ - if(event.type==SDL_KEYDOWN || event.type==SDL_KEYUP){ - *bas=(event.type==SDL_KEYDOWN)?1:0; - char* nom=SDL_GetKeyName(event.key.keysym.sym); - if(strlen(nom)==1 && nom[0]>=32 && nom[0]<128) *touche=nom[0]; else *touche=0; - _detail=event.key.keysym; - *detail=&_detail; - return 1; - } - } -return 0; -} - -void attendreEvenement(void){ -SDL_Event event; -while(SDL_WaitEvent(&event)) - switch(event.type){ - case SDL_KEYDOWN: - case SDL_MOUSEBUTTONDOWN: - case SDL_QUIT: - return; - } -} diff --git a/projets/Graphique/libgraph.h b/projets/Graphique/libgraph.h deleted file mode 100644 index e0e7097..0000000 --- a/projets/Graphique/libgraph.h +++ /dev/null @@ -1,33 +0,0 @@ -/**** Bibliotheque graphique (definitions) ****/ - -/** Constantes **/ - -#define COULEUR_BLANC 0 -#define COULEUR_NOIR 1 -#define COULEUR_ROUGE 2 -#define COULEUR_VERT 3 -#define COULEUR_BLEU 4 -#define COULEUR_ROSE 5 -#define COULEUR_GRIS 6 - -#define MAX_LUTINS 16 - -/** Prototypes **/ - -unsigned char creerSurface(int largeur,int hauteur,char *titre); -unsigned char chargerSurface(char *fichier); -int sauverSurface(char *fichier); -void majSurface(void); -void fermerSurface(void); - -void rectanglePlein(int x,int y,int l,int h,int c); -int couleurPixel(int x,int y); - -int chargerLutin(char *fichier,int couleur); -void afficherLutin(int lutin,int x,int y); -int creerLutin(int x,int y,int largeur,int hauteur,int couleur); -int sauverLutin(int lutin,char *nom); -void tailleLutin(int lutin,int *largeur,int *hauteur); - -unsigned char lireTouche(unsigned char *bas,char *touche,void **detail); -void attendreEvenement(void); diff --git a/projets/Graphique/libgraph.o b/projets/Graphique/libgraph.o deleted file mode 100644 index 3d91fea..0000000 Binary files a/projets/Graphique/libgraph.o and /dev/null differ diff --git a/projets/Liste/.directory b/projets/Liste/.directory deleted file mode 100644 index e8d027c..0000000 --- a/projets/Liste/.directory +++ /dev/null @@ -1,6 +0,0 @@ -[Dolphin] -Timestamp=2016,6,17,14,20,55 -Version=3 - -[Settings] -HiddenFilesShown=true diff --git a/projets/Liste/Makefile b/projets/Liste/Makefile deleted file mode 100644 index 7a639be..0000000 --- a/projets/Liste/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Makefile pour la bibliotheque graphique -# - -SOURCES = $(wildcard *.c) -OBJETS = $(SOURCES:.c=.o) -CIBLE = libListe.a - -# -# Nom de la cible principale -# - -all: $(CIBLE) - -# -# Cible de nettoyage -# - -clean: - rm -f core *.o $(CIBLE) - -# -# Dependances pour la bibliotheque -# - -$(CIBLE): $(OBJETS) - $(AR) rs $@ $? - -$(CIBLE:.a=).o: $(CIBLE:.a=).c $(CIBLE:.a=).h diff --git a/projets/Liste/libFile.c b/projets/Liste/libFile.c deleted file mode 100644 index 6f22558..0000000 --- a/projets/Liste/libFile.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include "libFile.h" -#include - -int taille(liste_t *l) -{ - return l->nombre; -} - -int enfiler (liste_t *l, element_t e, int taille){ -element_t nouveau=malloc(taille); -memcpy(nouveau,e,taille); -if (l->nombre >= l->alloue) - { - l->contenu = realloc(l->contenu, (l->alloue+300)*sizeof(element_t)); - l->alloue+=300; - } -l->contenu[l->nombre++]=nouveau; -return 0; -} - - - -int afficher(liste_t *l, void(*affichage)(element_t)) { -int i; -for(i=0; icontenu[i]); -return 0; -} - -int defiler(liste_t *l) -{ - int i; - - if(taille(l)>=1) - { - free(l->contenu[0]); - for(i=0; i < taille(l); i++) - { - l->contenu[i]=l->contenu[i+1]; - } - l->nombre--; - } - return 0; -} - -element_t premier(liste_t *l) { - return l->contenu[0]; } - -element_t dernier(liste_t *l) { - return l->contenu[(l->nombre)-1];} - -element_t enieme(int x, liste_t *l) { - return l->contenu[x]; -} diff --git a/projets/Liste/libFile.h b/projets/Liste/libFile.h deleted file mode 100644 index dbf391f..0000000 --- a/projets/Liste/libFile.h +++ /dev/null @@ -1,15 +0,0 @@ -typedef void *element_t; - - typedef struct { - element_t *contenu; - int nombre; - int alloue; -} liste_t; - -int taille(liste_t *l); -int enfiler (liste_t *l,element_t e, int taille); -int afficher (liste_t *l, void(*affichage)(element_t)); -int defiler(liste_t *l); -element_t dernier(liste_t *l); -element_t premier(liste_t *l); -element_t enieme(int x, liste_t *l); diff --git a/projets/Liste/libFile.o b/projets/Liste/libFile.o deleted file mode 100644 index 4ee1da0..0000000 Binary files a/projets/Liste/libFile.o and /dev/null differ diff --git a/projets/Liste/libListe.a b/projets/Liste/libListe.a deleted file mode 100644 index 55010c7..0000000 Binary files a/projets/Liste/libListe.a and /dev/null differ diff --git a/projets/Lutins/game_over.bmp b/projets/Lutins/game_over.bmp deleted file mode 100644 index 9320d63..0000000 Binary files a/projets/Lutins/game_over.bmp and /dev/null differ diff --git a/projets/Lutins/invader_bombe.bmp b/projets/Lutins/invader_bombe.bmp deleted file mode 100644 index 0b3e39b..0000000 Binary files a/projets/Lutins/invader_bombe.bmp and /dev/null differ diff --git a/projets/Lutins/invader_bouclier.bmp b/projets/Lutins/invader_bouclier.bmp deleted file mode 100644 index f71e3f3..0000000 Binary files a/projets/Lutins/invader_bouclier.bmp and /dev/null differ diff --git a/projets/Lutins/invader_canon.bmp b/projets/Lutins/invader_canon.bmp deleted file mode 100644 index 2b450dd..0000000 Binary files a/projets/Lutins/invader_canon.bmp and /dev/null differ diff --git a/projets/Lutins/invader_canon_ferraille.bmp b/projets/Lutins/invader_canon_ferraille.bmp deleted file mode 100644 index 575ec72..0000000 Binary files a/projets/Lutins/invader_canon_ferraille.bmp and /dev/null differ diff --git a/projets/Lutins/invader_missile.bmp b/projets/Lutins/invader_missile.bmp deleted file mode 100644 index 2095002..0000000 Binary files a/projets/Lutins/invader_missile.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre1_1.bmp b/projets/Lutins/invader_monstre1_1.bmp deleted file mode 100644 index cf56472..0000000 Binary files a/projets/Lutins/invader_monstre1_1.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre1_2.bmp b/projets/Lutins/invader_monstre1_2.bmp deleted file mode 100644 index cf56472..0000000 Binary files a/projets/Lutins/invader_monstre1_2.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre2_1.bmp b/projets/Lutins/invader_monstre2_1.bmp deleted file mode 100644 index 40bbf1f..0000000 Binary files a/projets/Lutins/invader_monstre2_1.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre2_2.bmp b/projets/Lutins/invader_monstre2_2.bmp deleted file mode 100644 index f99ec39..0000000 Binary files a/projets/Lutins/invader_monstre2_2.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre3_1.bmp b/projets/Lutins/invader_monstre3_1.bmp deleted file mode 100644 index a17556a..0000000 Binary files a/projets/Lutins/invader_monstre3_1.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre3_2.bmp b/projets/Lutins/invader_monstre3_2.bmp deleted file mode 100644 index a17556a..0000000 Binary files a/projets/Lutins/invader_monstre3_2.bmp and /dev/null differ diff --git a/projets/Lutins/invader_monstre_bouillie.bmp b/projets/Lutins/invader_monstre_bouillie.bmp deleted file mode 100644 index fa89282..0000000 Binary files a/projets/Lutins/invader_monstre_bouillie.bmp and /dev/null differ diff --git a/projets/Lutins/invader_ovni.bmp b/projets/Lutins/invader_ovni.bmp deleted file mode 100644 index da5fbd8..0000000 Binary files a/projets/Lutins/invader_ovni.bmp and /dev/null differ diff --git a/projets/Lutins/level1.bmp b/projets/Lutins/level1.bmp deleted file mode 100644 index ec2f29d..0000000 Binary files a/projets/Lutins/level1.bmp and /dev/null differ diff --git a/projets/Lutins/level2.bmp b/projets/Lutins/level2.bmp deleted file mode 100644 index 5b2e3cc..0000000 Binary files a/projets/Lutins/level2.bmp and /dev/null differ diff --git a/projets/Lutins/level3.bmp b/projets/Lutins/level3.bmp deleted file mode 100644 index c168bbf..0000000 Binary files a/projets/Lutins/level3.bmp and /dev/null differ diff --git a/projets/Lutins/level_cleared.PNG b/projets/Lutins/level_cleared.PNG deleted file mode 100644 index d74edc6..0000000 Binary files a/projets/Lutins/level_cleared.PNG and /dev/null differ diff --git a/projets/Lutins/level_cleared.bmp b/projets/Lutins/level_cleared.bmp deleted file mode 100644 index b487ef8..0000000 Binary files a/projets/Lutins/level_cleared.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_champi.bmp b/projets/Lutins/millepatte_champi.bmp deleted file mode 100644 index 6126777..0000000 Binary files a/projets/Lutins/millepatte_champi.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_corps_bas.bmp b/projets/Lutins/millepatte_corps_bas.bmp deleted file mode 100644 index ed4f660..0000000 Binary files a/projets/Lutins/millepatte_corps_bas.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_corps_droite.bmp b/projets/Lutins/millepatte_corps_droite.bmp deleted file mode 100644 index 36b049d..0000000 Binary files a/projets/Lutins/millepatte_corps_droite.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_corps_gauche.bmp b/projets/Lutins/millepatte_corps_gauche.bmp deleted file mode 100644 index a67092c..0000000 Binary files a/projets/Lutins/millepatte_corps_gauche.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_corps_haut.bmp b/projets/Lutins/millepatte_corps_haut.bmp deleted file mode 100644 index 92dd3c7..0000000 Binary files a/projets/Lutins/millepatte_corps_haut.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_tete_bas.bmp b/projets/Lutins/millepatte_tete_bas.bmp deleted file mode 100644 index c582ab3..0000000 Binary files a/projets/Lutins/millepatte_tete_bas.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_tete_droite.bmp b/projets/Lutins/millepatte_tete_droite.bmp deleted file mode 100644 index 7bce015..0000000 Binary files a/projets/Lutins/millepatte_tete_droite.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_tete_gauche.bmp b/projets/Lutins/millepatte_tete_gauche.bmp deleted file mode 100644 index f94c70b..0000000 Binary files a/projets/Lutins/millepatte_tete_gauche.bmp and /dev/null differ diff --git a/projets/Lutins/millepatte_tete_haut.bmp b/projets/Lutins/millepatte_tete_haut.bmp deleted file mode 100644 index c74c0c1..0000000 Binary files a/projets/Lutins/millepatte_tete_haut.bmp and /dev/null differ diff --git a/projets/Lutins/youwin.bmp b/projets/Lutins/youwin.bmp deleted file mode 100644 index 450e852..0000000 Binary files a/projets/Lutins/youwin.bmp and /dev/null differ diff --git a/projets/Makefile b/projets/Makefile deleted file mode 100644 index ea5eae2..0000000 --- a/projets/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -REPERTOIRES = Graphique Liste Testliste Centipede -COMPILE = $(REPERTOIRES:%=all-%) -DEVERMINE = $(REPERTOIRES:%=debug-%) -NETTOYAGE = $(REPERTOIRES:%=clean-%) -export CFLAGS += -g -Wall - -all: $(COMPILE) -$(COMPILE): - $(MAKE) -C $(@:all-%=%) - -debug: $(DEVERMINE) -$(DEVERMINE): CFLAGS += -g -DDEVERMINE -$(DEVERMINE): - $(MAKE) -C $(@:debug-%=%) - -clean: $(NETTOYAGE) -$(NETTOYAGE): - $(MAKE) -C $(@:clean-%=%) clean - -all-Main: all-Bibliotheque -debug-Main: debug-Bibliotheque - -.PHONY: $(COMPILE) $(DEVERMINE) $(NETTOYAGE) -.PHONY: all debug clean diff --git a/projets/Testliste/Makefile b/projets/Testliste/Makefile deleted file mode 100644 index c54edfb..0000000 --- a/projets/Testliste/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -SOURCES = $(wildcard *.c) -OBJETS = $(SOURCES:.c=.o) -BIBLIOTHEQUES = -L ../Liste -lListe -EXECUTABLE = projet -CFLAGS += -Wall -I ../Liste - -all: $(EXECUTABLE) -$(EXECUTABLE): $(OBJETS) - $(CC) -o $@ $^ $(BIBLIOTHEQUES) - -clean: - rm -rf $(EXECUTABLE) *.o diff --git a/projets/Testliste/projet b/projets/Testliste/projet deleted file mode 100644 index fc98fda..0000000 Binary files a/projets/Testliste/projet and /dev/null differ diff --git a/projets/Testliste/test.c b/projets/Testliste/test.c deleted file mode 100644 index ccb65fc..0000000 --- a/projets/Testliste/test.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include "libFile.h" -#include - - -int main(){ - -liste_t desnombres={NULL,0,0}; - -int petit = 10; -int moyen = 100; -int grand = 1000; - -enfiler(&desnombres,&petit,sizeof(int)); -enfiler(&desnombres,&moyen,sizeof(int)); -enfiler(&desnombres,&grand,sizeof(int)); -enfiler(&desnombres,&petit,sizeof(int)); - -//afficher(&desnombres,affichage); - -//defiler(&desnombres); - -//afficher(&desnombres,affichage); - -return 0; -} diff --git a/projets/Testliste/test.o b/projets/Testliste/test.o deleted file mode 100644 index cee60ab..0000000 Binary files a/projets/Testliste/test.o and /dev/null differ diff --git a/projets/projetsfile/Centipede/Makefile b/projets/projetsfile/Centipede/Makefile new file mode 100644 index 0000000..6b28b6e --- /dev/null +++ b/projets/projetsfile/Centipede/Makefile @@ -0,0 +1,13 @@ +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +BIBLIOTHEQUES = -L ../Liste -lListe -L ../Graphique -lgraph +EXECUTABLE = centipede +CFLAGS += -Wall -I ../Liste -I ../Graphique + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJETS) + $(CC) -o $@ $^ $(BIBLIOTHEQUES) -lSDL + +clean: + rm -rf $(EXECUTABLE) *.o diff --git a/projets/projetsfile/Centipede/centipede b/projets/projetsfile/Centipede/centipede new file mode 100755 index 0000000..ea221bd Binary files /dev/null and b/projets/projetsfile/Centipede/centipede differ diff --git a/projets/projetsfile/Centipede/progprinc.c b/projets/projetsfile/Centipede/progprinc.c new file mode 100644 index 0000000..dc01cf0 --- /dev/null +++ b/projets/projetsfile/Centipede/progprinc.c @@ -0,0 +1,301 @@ +#include +#include +#include +#include +#include +#include +#include +#define MAX_ELEMENTS 50 + +typedef struct { + char pseudo[MAX_ELEMENTS]; + char score; +}scorejoueur; + +typedef struct { + scorejoueur classement[10]; +}classement; + +typedef struct { + int x; + int y; +}position; + + +typedef struct { + position contenu[MAX_ELEMENTS]; + int nombre; + } liste_poly; + + +void creationgrille(){ +int i; +for(i = 0 ; i < 20; i++) + { + rectanglePlein(i*50,0,1,1000,5); //pose de la grille + rectanglePlein(0,i*50,1000,1,5); + } } + +void creerchampignons(int n,liste_poly *muschrooms,int champi){ + position poschampi; + int i,w; + int test=0; + for(w=0;wcontenu[i].x == poschampi.x && muschrooms->contenu[i].y == poschampi.y ) test=1; + } + if((poschampi.y > 570 || poschampi.y < 430) && test==0) + { + muschrooms->contenu[muschrooms->nombre++]=poschampi; + afficherLutin(champi,(muschrooms->contenu[w].x)+1,(muschrooms->contenu[w].y)+6); + } + else w--; + test = 0; + } +} + + +void creationcenti(liste_t *l, int Teted, int Corpsd){ + int i; + position *pos; + position posmillepatte; + for(i=0; i<4; i++) + { + posmillepatte.x = (300 + 50*i); + posmillepatte.y = 500; + enfiler(l,&posmillepatte,sizeof(position)); + } + //affichage des corpsd du centipede + for(i=0; i<4; i++) + { + pos = enieme(i,l); + afficherLutin(Corpsd,pos->x,pos->y); + } + + posmillepatte.x = 500; + posmillepatte.y = 500; + enfiler(l,&posmillepatte,sizeof(position)); //affichage de la tete du Centipède + pos = enieme(4,l); + afficherLutin(Teted,pos->x,pos->y); +} + +int main() { + SDL_keysym* detail; + srand(time(NULL)); + char touche; + unsigned char bas; + int largeur = 1000; + int hauteur = 1000; + char *titre = "Le Centipede"; + scorejoueur scorefait={.pseudo={'\0'}}; + scorejoueur autres; + scorejoueur lecture; + classement ranking; + position *pos; + position posmillepatte; + + + int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); + int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); + int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); + int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); + int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); + int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); + int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); + int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); + int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); + int gameover = chargerLutin("Lutins/game_over.bmp",0); + int level1 = chargerLutin("Lutins/level1.bmp",0); + int level2 = chargerLutin("Lutins/level2.bmp",0); + int level3 = chargerLutin("Lutins/level3.bmp",0); + int levelclr = chargerLutin("Lutins/level_cleared.bmp",0); + int youwin = chargerLutin("Lutins/youwin.bmp",0); + int Tete; + int Corps; + int abs, ord, obstacle, couleur,level=1,speed=5000,total=0,nombrechampis=6, s,ecriture=1,j,w,i; + + if(champi<0 || Teted<0 || Teteg<0 || Teteh <0 || Teteb<0 || Corpsg<0 || Corpsd<0 || Corpsh<0 || Corpsb<0 || gameover<0 || level1<0 || level2<0 || level3<0 || levelclr<0 || youwin<0){ printf("Image pas là\n"); exit(-1); } + + creerSurface(largeur,hauteur,titre); + majSurface(); + int gomme = creerLutin(0,0,50,50,-1); + +while(level<=3) { + + liste_poly muschrooms={.nombre=0}; + liste_t listecenti={NULL,0,0}; + int w,t,compteur=0,allonge; + + rectanglePlein(0,0,1000,1000,1); + + if(level==1) { afficherLutin(level1,250,250); majSurface(); sleep(1); } + if(level==2) { afficherLutin(level2,250,250); majSurface(); sleep(1); } + if(level==3) { afficherLutin(level3,250,250); majSurface(); sleep(1); } + + rectanglePlein(0,0,1000,1000,-1); + + creationcenti(&listecenti,Teted,Corpsd); + + creerchampignons(nombrechampis,&muschrooms,champi); + + majSurface(); + + attendreEvenement(); + + s = 0; + t = 0; + + while(1){ + for(i=0;isym==SDLK_RIGHT) t=0; + if(detail->sym==SDLK_UP) t=1; + if(detail->sym==SDLK_LEFT) t=2; + if(detail->sym==SDLK_DOWN) t=3; + } + + usleep(1); + } + if((t==0 && s!=2) || s==0) { abs=50; ord=0; Tete = Teted; Corps = Corpsd; s=0; } + if((t==1 && s!=3) || s==1) { abs=0; ord=(-50); Tete = Teteh; Corps = Corpsh; s=1; } + if((t==2 && s!=0) || s==2) { abs=-50; ord=0; Tete = Teteg; Corps = Corpsg; s=2; } + if((t==3 && s!=1) || s==3) { abs=0; ord=50; Tete = Teteb; Corps = Corpsb; s=3; } + + pos = dernier(&listecenti); + posmillepatte.x = pos->x+abs; + posmillepatte.y = pos->y+ord; + if(posmillepatte.x==1000 || posmillepatte.y==1000 || posmillepatte.x==-50 || posmillepatte.y==-50) + { + afficherLutin(gameover,250,433); + majSurface(); + sleep(5); + break; + } + + majSurface(); + couleur = couleurPixel(posmillepatte.x+25,posmillepatte.y+25); + if(couleur!=1) obstacle = 1; + else obstacle = 0; + allonge = 0; + + if(obstacle==1){ + for(w=0;wx,pos->y); + afficherLutin(Corps,(pos->x),pos->y); + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); + afficherLutin(Tete,posmillepatte.x,posmillepatte.y); + compteur++; + } + else { + afficherLutin(gameover,250,433); + majSurface(); + sleep(5); + break; + } + + } + + if(obstacle==0){ + afficherLutin(gomme,pos->x,pos->y); + afficherLutin(Corps,(pos->x),pos->y); + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); + afficherLutin(Tete,posmillepatte.x,posmillepatte.y); + pos = premier(&listecenti); + afficherLutin(gomme,pos->x,pos->y); + defiler(&listecenti); + } + majSurface(); + + if(compteur==nombrechampis) break; + + if(touche=='a') + { + fermerSurface(); //condition d'arret + return 0; + } + } + + + total = total+compteur; + if(compteur != nombrechampis) break; + if(level==3) { afficherLutin(youwin,204,400); majSurface(); sleep(3); } + else { afficherLutin(levelclr,304,454); majSurface(); sleep(3); } + compteur = 0; + nombrechampis = nombrechampis+3; + speed = speed/2.2; + level++; + +} + + printf("votre score est de %d\n",total); + + for(i=0;i<10;i++) // initialisation de la liste classement + { + strcpy(ranking.classement[i].pseudo,"vide"); + ranking.classement[i].score=0; + } + + fermerSurface(); + printf("Saisissez votre pseudo\n"); + scanf("%s",scorefait.pseudo); + scorefait.score=total; + + + FILE *fichier=fopen("scores.txt","a+"); // Gestion fichier + fclose(fichier); + fichier=fopen("scores.txt","r+"); + if(fichier!=NULL){ + + while((fread(&autres,sizeof(autres),1,fichier)!=0)) + { + if(strcmp(autres.pseudo,scorefait.pseudo)==0) + { + if(total>autres.score) + { + fseek(fichier,-sizeof(scorefait),SEEK_CUR); + fwrite(&scorefait,sizeof(scorefait),1,fichier); + } + ecriture=0; + break; + } + ecriture=1; + } + if(ecriture==1) {fwrite(&scorefait,sizeof(scorefait),1,fichier);} + } + rewind(fichier); + while((fread(&lecture,sizeof(lecture),1,fichier)!=0)) + { + for(w=0;w<10;w++) + { + if(lecture.score>ranking.classement[w].score) + { + for(j=10;j>w;j--) + { + strcpy(ranking.classement[j].pseudo,ranking.classement[j-1].pseudo); // gestion et affichage classement + ranking.classement[j].score=ranking.classement[j-1].score; + } + strcpy(ranking.classement[w].pseudo,lecture.pseudo); + ranking.classement[w].score=lecture.score; + break; + } + } + } + printf("RANKING :\n"); + for(w=0;w<10;w++) + { + printf("%i : %s , score : %d\n",w+1,ranking.classement[w].pseudo,ranking.classement[w].score); + } + fclose(fichier); + + return 0; +} + diff --git a/projets/projetsfile/Centipede/progprinc.c~ b/projets/projetsfile/Centipede/progprinc.c~ new file mode 100644 index 0000000..dc01cf0 --- /dev/null +++ b/projets/projetsfile/Centipede/progprinc.c~ @@ -0,0 +1,301 @@ +#include +#include +#include +#include +#include +#include +#include +#define MAX_ELEMENTS 50 + +typedef struct { + char pseudo[MAX_ELEMENTS]; + char score; +}scorejoueur; + +typedef struct { + scorejoueur classement[10]; +}classement; + +typedef struct { + int x; + int y; +}position; + + +typedef struct { + position contenu[MAX_ELEMENTS]; + int nombre; + } liste_poly; + + +void creationgrille(){ +int i; +for(i = 0 ; i < 20; i++) + { + rectanglePlein(i*50,0,1,1000,5); //pose de la grille + rectanglePlein(0,i*50,1000,1,5); + } } + +void creerchampignons(int n,liste_poly *muschrooms,int champi){ + position poschampi; + int i,w; + int test=0; + for(w=0;wcontenu[i].x == poschampi.x && muschrooms->contenu[i].y == poschampi.y ) test=1; + } + if((poschampi.y > 570 || poschampi.y < 430) && test==0) + { + muschrooms->contenu[muschrooms->nombre++]=poschampi; + afficherLutin(champi,(muschrooms->contenu[w].x)+1,(muschrooms->contenu[w].y)+6); + } + else w--; + test = 0; + } +} + + +void creationcenti(liste_t *l, int Teted, int Corpsd){ + int i; + position *pos; + position posmillepatte; + for(i=0; i<4; i++) + { + posmillepatte.x = (300 + 50*i); + posmillepatte.y = 500; + enfiler(l,&posmillepatte,sizeof(position)); + } + //affichage des corpsd du centipede + for(i=0; i<4; i++) + { + pos = enieme(i,l); + afficherLutin(Corpsd,pos->x,pos->y); + } + + posmillepatte.x = 500; + posmillepatte.y = 500; + enfiler(l,&posmillepatte,sizeof(position)); //affichage de la tete du Centipède + pos = enieme(4,l); + afficherLutin(Teted,pos->x,pos->y); +} + +int main() { + SDL_keysym* detail; + srand(time(NULL)); + char touche; + unsigned char bas; + int largeur = 1000; + int hauteur = 1000; + char *titre = "Le Centipede"; + scorejoueur scorefait={.pseudo={'\0'}}; + scorejoueur autres; + scorejoueur lecture; + classement ranking; + position *pos; + position posmillepatte; + + + int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); + int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); + int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); + int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); + int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); + int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); + int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); + int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); + int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); + int gameover = chargerLutin("Lutins/game_over.bmp",0); + int level1 = chargerLutin("Lutins/level1.bmp",0); + int level2 = chargerLutin("Lutins/level2.bmp",0); + int level3 = chargerLutin("Lutins/level3.bmp",0); + int levelclr = chargerLutin("Lutins/level_cleared.bmp",0); + int youwin = chargerLutin("Lutins/youwin.bmp",0); + int Tete; + int Corps; + int abs, ord, obstacle, couleur,level=1,speed=5000,total=0,nombrechampis=6, s,ecriture=1,j,w,i; + + if(champi<0 || Teted<0 || Teteg<0 || Teteh <0 || Teteb<0 || Corpsg<0 || Corpsd<0 || Corpsh<0 || Corpsb<0 || gameover<0 || level1<0 || level2<0 || level3<0 || levelclr<0 || youwin<0){ printf("Image pas là\n"); exit(-1); } + + creerSurface(largeur,hauteur,titre); + majSurface(); + int gomme = creerLutin(0,0,50,50,-1); + +while(level<=3) { + + liste_poly muschrooms={.nombre=0}; + liste_t listecenti={NULL,0,0}; + int w,t,compteur=0,allonge; + + rectanglePlein(0,0,1000,1000,1); + + if(level==1) { afficherLutin(level1,250,250); majSurface(); sleep(1); } + if(level==2) { afficherLutin(level2,250,250); majSurface(); sleep(1); } + if(level==3) { afficherLutin(level3,250,250); majSurface(); sleep(1); } + + rectanglePlein(0,0,1000,1000,-1); + + creationcenti(&listecenti,Teted,Corpsd); + + creerchampignons(nombrechampis,&muschrooms,champi); + + majSurface(); + + attendreEvenement(); + + s = 0; + t = 0; + + while(1){ + for(i=0;isym==SDLK_RIGHT) t=0; + if(detail->sym==SDLK_UP) t=1; + if(detail->sym==SDLK_LEFT) t=2; + if(detail->sym==SDLK_DOWN) t=3; + } + + usleep(1); + } + if((t==0 && s!=2) || s==0) { abs=50; ord=0; Tete = Teted; Corps = Corpsd; s=0; } + if((t==1 && s!=3) || s==1) { abs=0; ord=(-50); Tete = Teteh; Corps = Corpsh; s=1; } + if((t==2 && s!=0) || s==2) { abs=-50; ord=0; Tete = Teteg; Corps = Corpsg; s=2; } + if((t==3 && s!=1) || s==3) { abs=0; ord=50; Tete = Teteb; Corps = Corpsb; s=3; } + + pos = dernier(&listecenti); + posmillepatte.x = pos->x+abs; + posmillepatte.y = pos->y+ord; + if(posmillepatte.x==1000 || posmillepatte.y==1000 || posmillepatte.x==-50 || posmillepatte.y==-50) + { + afficherLutin(gameover,250,433); + majSurface(); + sleep(5); + break; + } + + majSurface(); + couleur = couleurPixel(posmillepatte.x+25,posmillepatte.y+25); + if(couleur!=1) obstacle = 1; + else obstacle = 0; + allonge = 0; + + if(obstacle==1){ + for(w=0;wx,pos->y); + afficherLutin(Corps,(pos->x),pos->y); + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); + afficherLutin(Tete,posmillepatte.x,posmillepatte.y); + compteur++; + } + else { + afficherLutin(gameover,250,433); + majSurface(); + sleep(5); + break; + } + + } + + if(obstacle==0){ + afficherLutin(gomme,pos->x,pos->y); + afficherLutin(Corps,(pos->x),pos->y); + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); + afficherLutin(Tete,posmillepatte.x,posmillepatte.y); + pos = premier(&listecenti); + afficherLutin(gomme,pos->x,pos->y); + defiler(&listecenti); + } + majSurface(); + + if(compteur==nombrechampis) break; + + if(touche=='a') + { + fermerSurface(); //condition d'arret + return 0; + } + } + + + total = total+compteur; + if(compteur != nombrechampis) break; + if(level==3) { afficherLutin(youwin,204,400); majSurface(); sleep(3); } + else { afficherLutin(levelclr,304,454); majSurface(); sleep(3); } + compteur = 0; + nombrechampis = nombrechampis+3; + speed = speed/2.2; + level++; + +} + + printf("votre score est de %d\n",total); + + for(i=0;i<10;i++) // initialisation de la liste classement + { + strcpy(ranking.classement[i].pseudo,"vide"); + ranking.classement[i].score=0; + } + + fermerSurface(); + printf("Saisissez votre pseudo\n"); + scanf("%s",scorefait.pseudo); + scorefait.score=total; + + + FILE *fichier=fopen("scores.txt","a+"); // Gestion fichier + fclose(fichier); + fichier=fopen("scores.txt","r+"); + if(fichier!=NULL){ + + while((fread(&autres,sizeof(autres),1,fichier)!=0)) + { + if(strcmp(autres.pseudo,scorefait.pseudo)==0) + { + if(total>autres.score) + { + fseek(fichier,-sizeof(scorefait),SEEK_CUR); + fwrite(&scorefait,sizeof(scorefait),1,fichier); + } + ecriture=0; + break; + } + ecriture=1; + } + if(ecriture==1) {fwrite(&scorefait,sizeof(scorefait),1,fichier);} + } + rewind(fichier); + while((fread(&lecture,sizeof(lecture),1,fichier)!=0)) + { + for(w=0;w<10;w++) + { + if(lecture.score>ranking.classement[w].score) + { + for(j=10;j>w;j--) + { + strcpy(ranking.classement[j].pseudo,ranking.classement[j-1].pseudo); // gestion et affichage classement + ranking.classement[j].score=ranking.classement[j-1].score; + } + strcpy(ranking.classement[w].pseudo,lecture.pseudo); + ranking.classement[w].score=lecture.score; + break; + } + } + } + printf("RANKING :\n"); + for(w=0;w<10;w++) + { + printf("%i : %s , score : %d\n",w+1,ranking.classement[w].pseudo,ranking.classement[w].score); + } + fclose(fichier); + + return 0; +} + diff --git a/projets/projetsfile/Centipede/progprinc.o b/projets/projetsfile/Centipede/progprinc.o new file mode 100644 index 0000000..4bfcb97 Binary files /dev/null and b/projets/projetsfile/Centipede/progprinc.o differ diff --git a/projets/projetsfile/Centipede/scores.txt b/projets/projetsfile/Centipede/scores.txt new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/projets/projetsfile/Centipede/scores.txt @@ -0,0 +1 @@ + diff --git a/projets/projetsfile/Graphique/Makefile b/projets/projetsfile/Graphique/Makefile new file mode 100644 index 0000000..5791d72 --- /dev/null +++ b/projets/projetsfile/Graphique/Makefile @@ -0,0 +1,29 @@ +# +# Makefile pour la bibliotheque graphique +# + +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +CIBLE = libgraph.a + +# +# Nom de la cible principale +# + +all: $(CIBLE) + +# +# Cible de nettoyage +# + +clean: + rm -f core *.o $(CIBLE) + +# +# Dependances pour la bibliotheque +# + +$(CIBLE): $(OBJETS) + $(AR) rs $@ $? + +$(CIBLE:.a=).o: $(CIBLE:.a=).c $(CIBLE:.a=).h diff --git a/projets/projetsfile/Graphique/libgraph.a b/projets/projetsfile/Graphique/libgraph.a new file mode 100644 index 0000000..2789297 Binary files /dev/null and b/projets/projetsfile/Graphique/libgraph.a differ diff --git a/projets/projetsfile/Graphique/libgraph.c b/projets/projetsfile/Graphique/libgraph.c new file mode 100644 index 0000000..bff8b0f --- /dev/null +++ b/projets/projetsfile/Graphique/libgraph.c @@ -0,0 +1,180 @@ +/**** Bibliotheque graphique ****/ + +/** Fichiers d'inclusion **/ + +#include + +#include "libgraph.h" + +/** Types **/ + +typedef struct { int r,v,b; } couleur; + +/** Constantes **/ + +#define BITS_PAR_PIXEL 32 + +static const couleur couleurs[]={ + {255,255,255}, + {0,0,0}, + {255,0,0}, + {0,255,0}, + {0,0,255}, + {255,105,180}, + {150,150,150}, + {-1,-1,-1} + }; + +/** Variables globales **/ + +static SDL_Surface *surface; + +/** Fonctions **/ + +/* Initialisation de la surface dessinable */ + +unsigned char creerSurface(int largeur,int hauteur,char *titre){ +SDL_Init(SDL_INIT_VIDEO); +SDL_WM_SetCaption(titre,titre); +surface=SDL_SetVideoMode(largeur,hauteur,BITS_PAR_PIXEL,SDL_DOUBLEBUF); +return (surface!=NULL); +} + +/* Fermeture de la surface dessinable */ + +void fermerSurface(void){ +if(surface!=NULL) SDL_FreeSurface(surface); +SDL_Quit(); +} + +/* Creation d'une couleur */ + +static int creerCouleur(int ncouleur){ +couleur c=couleurs[ncouleur]; +return SDL_MapRGB(surface->format,c.r,c.v,c.b); +} + +/* Dessin d'un rectangle plein */ + +void rectanglePlein(int x,int y,int l,int h,int c){ +SDL_Rect rectangle={x,y,l,h}; +SDL_FillRect(surface,&rectangle,creerCouleur(c)); +//SDL_Flip(surface); +} + +/* Manipulation de lutins */ + +static SDL_Surface *lutins[MAX_LUTINS]; +static int lutins_nb=0; + +static void configurerLutin(SDL_Surface *lutin,int ncouleur){ +couleur c=couleurs[ncouleur]; +int fond=SDL_MapRGB(lutin->format,c.r,c.v,c.b); +SDL_SetColorKey(lutin,SDL_SRCCOLORKEY|SDL_RLEACCEL,fond); +} + +int chargerLutin(char *fichier,int couleur){ +if(lutins_nb>=MAX_LUTINS) return -2; +SDL_Surface *lutin=SDL_LoadBMP(fichier); +if(lutin!=NULL){ + lutins[lutins_nb++]=lutin; + if(couleur>=0) configurerLutin(lutin,couleur); + return lutins_nb-1; + } +return -1; +} + +void afficherLutin(int lutin,int x,int y){ +SDL_Rect position; +position.x=x; +position.y=y; +SDL_BlitSurface(lutins[lutin],NULL,surface,&position); +} + +int creerLutin(int x,int y,int largeur,int hauteur,int couleur){ +if(lutins_nb>=MAX_LUTINS) return -2; +int rmask,gmask,bmask,amask; +#if SDL_BYTEORDER == SDL_BIG_ENDIAN +rmask=0xff000000; gmask=0x00ff0000; bmask=0x0000ff00; amask=0x000000ff; +#else +rmask=0x000000ff; gmask=0x0000ff00; bmask=0x00ff0000; amask=0xff000000; +#endif +if(couleur<0) amask=0x00000000; +SDL_Surface *lutin=SDL_CreateRGBSurface(0,largeur,hauteur,BITS_PAR_PIXEL,rmask,gmask,bmask,amask); +SDL_Rect fenetre; +fenetre.x=x; +fenetre.y=y; +fenetre.h=hauteur; +fenetre.w=largeur; +SDL_BlitSurface(surface,&fenetre,lutin,NULL); +lutins[lutins_nb++]=lutin; +if(couleur>=0) configurerLutin(lutin,couleur); +return lutins_nb-1; +} + +void tailleLutin(int lutin,int *largeur,int *hauteur){ +*largeur=lutins[lutin]->w; +*hauteur=lutins[lutin]->h; +} + +int sauverLutin(int lutin,char *nom){ return SDL_SaveBMP(lutins[lutin],nom); } + +/* Manipulation de copie de surface en BMP */ + +int sauverSurface(char *fichier){ return SDL_SaveBMP(surface,fichier); } + +unsigned char chargerSurface(char *fichier){ +SDL_Surface *image=SDL_LoadBMP(fichier); +if(image!=NULL){ + SDL_BlitSurface(image,NULL,surface,NULL); + SDL_Flip(surface); + } +return (image!=NULL); +} + +void majSurface(void){ SDL_Flip(surface); } + +/* Trouver la couleur d'un pixel */ + +int couleurPixel(int x,int y){ +int bpp=surface->format->BytesPerPixel; +Uint32 *p=(Uint32 *)(surface->pixels+y*surface->pitch+x*bpp); +Uint8 r,v,b; +SDL_GetRGB(*p,surface->format,&r,&v,&b); +int i=0; +while(1){ + if(couleurs[i].r<0) break; + if(r==couleurs[i].r && v==couleurs[i].v && b==couleurs[i].b) break; + i++; + } +if(couleurs[i].r<0) return -1; else return i; +} + +/* Fonction de traitement des événements */ + +unsigned char lireTouche(unsigned char *bas,char *touche,void **detail){ +static SDL_keysym _detail; +SDL_Event event; +while(SDL_PollEvent(&event)){ + if(event.type==SDL_KEYDOWN || event.type==SDL_KEYUP){ + *bas=(event.type==SDL_KEYDOWN)?1:0; + char* nom=SDL_GetKeyName(event.key.keysym.sym); + if(strlen(nom)==1 && nom[0]>=32 && nom[0]<128) *touche=nom[0]; else *touche=0; + _detail=event.key.keysym; + *detail=&_detail; + return 1; + } + } +return 0; +} + +void attendreEvenement(void){ +SDL_Event event; +while(SDL_WaitEvent(&event)) + switch(event.type){ + case SDL_KEYDOWN: + case SDL_MOUSEBUTTONDOWN: + case SDL_QUIT: + return; + } +} diff --git a/projets/projetsfile/Graphique/libgraph.h b/projets/projetsfile/Graphique/libgraph.h new file mode 100644 index 0000000..e0e7097 --- /dev/null +++ b/projets/projetsfile/Graphique/libgraph.h @@ -0,0 +1,33 @@ +/**** Bibliotheque graphique (definitions) ****/ + +/** Constantes **/ + +#define COULEUR_BLANC 0 +#define COULEUR_NOIR 1 +#define COULEUR_ROUGE 2 +#define COULEUR_VERT 3 +#define COULEUR_BLEU 4 +#define COULEUR_ROSE 5 +#define COULEUR_GRIS 6 + +#define MAX_LUTINS 16 + +/** Prototypes **/ + +unsigned char creerSurface(int largeur,int hauteur,char *titre); +unsigned char chargerSurface(char *fichier); +int sauverSurface(char *fichier); +void majSurface(void); +void fermerSurface(void); + +void rectanglePlein(int x,int y,int l,int h,int c); +int couleurPixel(int x,int y); + +int chargerLutin(char *fichier,int couleur); +void afficherLutin(int lutin,int x,int y); +int creerLutin(int x,int y,int largeur,int hauteur,int couleur); +int sauverLutin(int lutin,char *nom); +void tailleLutin(int lutin,int *largeur,int *hauteur); + +unsigned char lireTouche(unsigned char *bas,char *touche,void **detail); +void attendreEvenement(void); diff --git a/projets/projetsfile/Graphique/libgraph.o b/projets/projetsfile/Graphique/libgraph.o new file mode 100644 index 0000000..3d91fea Binary files /dev/null and b/projets/projetsfile/Graphique/libgraph.o differ diff --git a/projets/projetsfile/Liste/.directory b/projets/projetsfile/Liste/.directory new file mode 100644 index 0000000..e8d027c --- /dev/null +++ b/projets/projetsfile/Liste/.directory @@ -0,0 +1,6 @@ +[Dolphin] +Timestamp=2016,6,17,14,20,55 +Version=3 + +[Settings] +HiddenFilesShown=true diff --git a/projets/projetsfile/Liste/Makefile b/projets/projetsfile/Liste/Makefile new file mode 100644 index 0000000..7a639be --- /dev/null +++ b/projets/projetsfile/Liste/Makefile @@ -0,0 +1,29 @@ +# +# Makefile pour la bibliotheque graphique +# + +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +CIBLE = libListe.a + +# +# Nom de la cible principale +# + +all: $(CIBLE) + +# +# Cible de nettoyage +# + +clean: + rm -f core *.o $(CIBLE) + +# +# Dependances pour la bibliotheque +# + +$(CIBLE): $(OBJETS) + $(AR) rs $@ $? + +$(CIBLE:.a=).o: $(CIBLE:.a=).c $(CIBLE:.a=).h diff --git a/projets/projetsfile/Liste/libFile.c b/projets/projetsfile/Liste/libFile.c new file mode 100644 index 0000000..6f22558 --- /dev/null +++ b/projets/projetsfile/Liste/libFile.c @@ -0,0 +1,55 @@ +#include +#include +#include "libFile.h" +#include + +int taille(liste_t *l) +{ + return l->nombre; +} + +int enfiler (liste_t *l, element_t e, int taille){ +element_t nouveau=malloc(taille); +memcpy(nouveau,e,taille); +if (l->nombre >= l->alloue) + { + l->contenu = realloc(l->contenu, (l->alloue+300)*sizeof(element_t)); + l->alloue+=300; + } +l->contenu[l->nombre++]=nouveau; +return 0; +} + + + +int afficher(liste_t *l, void(*affichage)(element_t)) { +int i; +for(i=0; icontenu[i]); +return 0; +} + +int defiler(liste_t *l) +{ + int i; + + if(taille(l)>=1) + { + free(l->contenu[0]); + for(i=0; i < taille(l); i++) + { + l->contenu[i]=l->contenu[i+1]; + } + l->nombre--; + } + return 0; +} + +element_t premier(liste_t *l) { + return l->contenu[0]; } + +element_t dernier(liste_t *l) { + return l->contenu[(l->nombre)-1];} + +element_t enieme(int x, liste_t *l) { + return l->contenu[x]; +} diff --git a/projets/projetsfile/Liste/libFile.h b/projets/projetsfile/Liste/libFile.h new file mode 100644 index 0000000..dbf391f --- /dev/null +++ b/projets/projetsfile/Liste/libFile.h @@ -0,0 +1,15 @@ +typedef void *element_t; + + typedef struct { + element_t *contenu; + int nombre; + int alloue; +} liste_t; + +int taille(liste_t *l); +int enfiler (liste_t *l,element_t e, int taille); +int afficher (liste_t *l, void(*affichage)(element_t)); +int defiler(liste_t *l); +element_t dernier(liste_t *l); +element_t premier(liste_t *l); +element_t enieme(int x, liste_t *l); diff --git a/projets/projetsfile/Liste/libFile.o b/projets/projetsfile/Liste/libFile.o new file mode 100644 index 0000000..4ee1da0 Binary files /dev/null and b/projets/projetsfile/Liste/libFile.o differ diff --git a/projets/projetsfile/Liste/libListe.a b/projets/projetsfile/Liste/libListe.a new file mode 100644 index 0000000..55010c7 Binary files /dev/null and b/projets/projetsfile/Liste/libListe.a differ diff --git a/projets/projetsfile/Lutins/game_over.bmp b/projets/projetsfile/Lutins/game_over.bmp new file mode 100644 index 0000000..9320d63 Binary files /dev/null and b/projets/projetsfile/Lutins/game_over.bmp differ diff --git a/projets/projetsfile/Lutins/invader_bombe.bmp b/projets/projetsfile/Lutins/invader_bombe.bmp new file mode 100644 index 0000000..0b3e39b Binary files /dev/null and b/projets/projetsfile/Lutins/invader_bombe.bmp differ diff --git a/projets/projetsfile/Lutins/invader_bouclier.bmp b/projets/projetsfile/Lutins/invader_bouclier.bmp new file mode 100644 index 0000000..f71e3f3 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_bouclier.bmp differ diff --git a/projets/projetsfile/Lutins/invader_canon.bmp b/projets/projetsfile/Lutins/invader_canon.bmp new file mode 100644 index 0000000..2b450dd Binary files /dev/null and b/projets/projetsfile/Lutins/invader_canon.bmp differ diff --git a/projets/projetsfile/Lutins/invader_canon_ferraille.bmp b/projets/projetsfile/Lutins/invader_canon_ferraille.bmp new file mode 100644 index 0000000..575ec72 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_canon_ferraille.bmp differ diff --git a/projets/projetsfile/Lutins/invader_missile.bmp b/projets/projetsfile/Lutins/invader_missile.bmp new file mode 100644 index 0000000..2095002 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_missile.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre1_1.bmp b/projets/projetsfile/Lutins/invader_monstre1_1.bmp new file mode 100644 index 0000000..cf56472 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre1_1.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre1_2.bmp b/projets/projetsfile/Lutins/invader_monstre1_2.bmp new file mode 100644 index 0000000..cf56472 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre1_2.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre2_1.bmp b/projets/projetsfile/Lutins/invader_monstre2_1.bmp new file mode 100644 index 0000000..40bbf1f Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre2_1.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre2_2.bmp b/projets/projetsfile/Lutins/invader_monstre2_2.bmp new file mode 100644 index 0000000..f99ec39 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre2_2.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre3_1.bmp b/projets/projetsfile/Lutins/invader_monstre3_1.bmp new file mode 100644 index 0000000..a17556a Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre3_1.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre3_2.bmp b/projets/projetsfile/Lutins/invader_monstre3_2.bmp new file mode 100644 index 0000000..a17556a Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre3_2.bmp differ diff --git a/projets/projetsfile/Lutins/invader_monstre_bouillie.bmp b/projets/projetsfile/Lutins/invader_monstre_bouillie.bmp new file mode 100644 index 0000000..fa89282 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_monstre_bouillie.bmp differ diff --git a/projets/projetsfile/Lutins/invader_ovni.bmp b/projets/projetsfile/Lutins/invader_ovni.bmp new file mode 100644 index 0000000..da5fbd8 Binary files /dev/null and b/projets/projetsfile/Lutins/invader_ovni.bmp differ diff --git a/projets/projetsfile/Lutins/level1.bmp b/projets/projetsfile/Lutins/level1.bmp new file mode 100644 index 0000000..ec2f29d Binary files /dev/null and b/projets/projetsfile/Lutins/level1.bmp differ diff --git a/projets/projetsfile/Lutins/level2.bmp b/projets/projetsfile/Lutins/level2.bmp new file mode 100644 index 0000000..5b2e3cc Binary files /dev/null and b/projets/projetsfile/Lutins/level2.bmp differ diff --git a/projets/projetsfile/Lutins/level3.bmp b/projets/projetsfile/Lutins/level3.bmp new file mode 100644 index 0000000..c168bbf Binary files /dev/null and b/projets/projetsfile/Lutins/level3.bmp differ diff --git a/projets/projetsfile/Lutins/level_cleared.PNG b/projets/projetsfile/Lutins/level_cleared.PNG new file mode 100644 index 0000000..d74edc6 Binary files /dev/null and b/projets/projetsfile/Lutins/level_cleared.PNG differ diff --git a/projets/projetsfile/Lutins/level_cleared.bmp b/projets/projetsfile/Lutins/level_cleared.bmp new file mode 100644 index 0000000..b487ef8 Binary files /dev/null and b/projets/projetsfile/Lutins/level_cleared.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_champi.bmp b/projets/projetsfile/Lutins/millepatte_champi.bmp new file mode 100644 index 0000000..6126777 Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_champi.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_corps_bas.bmp b/projets/projetsfile/Lutins/millepatte_corps_bas.bmp new file mode 100644 index 0000000..ed4f660 Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_corps_bas.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_corps_droite.bmp b/projets/projetsfile/Lutins/millepatte_corps_droite.bmp new file mode 100644 index 0000000..36b049d Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_corps_droite.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_corps_gauche.bmp b/projets/projetsfile/Lutins/millepatte_corps_gauche.bmp new file mode 100644 index 0000000..a67092c Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_corps_gauche.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_corps_haut.bmp b/projets/projetsfile/Lutins/millepatte_corps_haut.bmp new file mode 100644 index 0000000..92dd3c7 Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_corps_haut.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_tete_bas.bmp b/projets/projetsfile/Lutins/millepatte_tete_bas.bmp new file mode 100644 index 0000000..c582ab3 Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_tete_bas.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_tete_droite.bmp b/projets/projetsfile/Lutins/millepatte_tete_droite.bmp new file mode 100644 index 0000000..7bce015 Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_tete_droite.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_tete_gauche.bmp b/projets/projetsfile/Lutins/millepatte_tete_gauche.bmp new file mode 100644 index 0000000..f94c70b Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_tete_gauche.bmp differ diff --git a/projets/projetsfile/Lutins/millepatte_tete_haut.bmp b/projets/projetsfile/Lutins/millepatte_tete_haut.bmp new file mode 100644 index 0000000..c74c0c1 Binary files /dev/null and b/projets/projetsfile/Lutins/millepatte_tete_haut.bmp differ diff --git a/projets/projetsfile/Lutins/youwin.bmp b/projets/projetsfile/Lutins/youwin.bmp new file mode 100644 index 0000000..450e852 Binary files /dev/null and b/projets/projetsfile/Lutins/youwin.bmp differ diff --git a/projets/projetsfile/Makefile b/projets/projetsfile/Makefile new file mode 100644 index 0000000..ea5eae2 --- /dev/null +++ b/projets/projetsfile/Makefile @@ -0,0 +1,24 @@ +REPERTOIRES = Graphique Liste Testliste Centipede +COMPILE = $(REPERTOIRES:%=all-%) +DEVERMINE = $(REPERTOIRES:%=debug-%) +NETTOYAGE = $(REPERTOIRES:%=clean-%) +export CFLAGS += -g -Wall + +all: $(COMPILE) +$(COMPILE): + $(MAKE) -C $(@:all-%=%) + +debug: $(DEVERMINE) +$(DEVERMINE): CFLAGS += -g -DDEVERMINE +$(DEVERMINE): + $(MAKE) -C $(@:debug-%=%) + +clean: $(NETTOYAGE) +$(NETTOYAGE): + $(MAKE) -C $(@:clean-%=%) clean + +all-Main: all-Bibliotheque +debug-Main: debug-Bibliotheque + +.PHONY: $(COMPILE) $(DEVERMINE) $(NETTOYAGE) +.PHONY: all debug clean diff --git a/projets/projetsfile/Testliste/Makefile b/projets/projetsfile/Testliste/Makefile new file mode 100644 index 0000000..c54edfb --- /dev/null +++ b/projets/projetsfile/Testliste/Makefile @@ -0,0 +1,12 @@ +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +BIBLIOTHEQUES = -L ../Liste -lListe +EXECUTABLE = projet +CFLAGS += -Wall -I ../Liste + +all: $(EXECUTABLE) +$(EXECUTABLE): $(OBJETS) + $(CC) -o $@ $^ $(BIBLIOTHEQUES) + +clean: + rm -rf $(EXECUTABLE) *.o diff --git a/projets/projetsfile/Testliste/projet b/projets/projetsfile/Testliste/projet new file mode 100644 index 0000000..fc98fda Binary files /dev/null and b/projets/projetsfile/Testliste/projet differ diff --git a/projets/projetsfile/Testliste/test.c b/projets/projetsfile/Testliste/test.c new file mode 100644 index 0000000..ccb65fc --- /dev/null +++ b/projets/projetsfile/Testliste/test.c @@ -0,0 +1,27 @@ +#include +#include +#include "libFile.h" +#include + + +int main(){ + +liste_t desnombres={NULL,0,0}; + +int petit = 10; +int moyen = 100; +int grand = 1000; + +enfiler(&desnombres,&petit,sizeof(int)); +enfiler(&desnombres,&moyen,sizeof(int)); +enfiler(&desnombres,&grand,sizeof(int)); +enfiler(&desnombres,&petit,sizeof(int)); + +//afficher(&desnombres,affichage); + +//defiler(&desnombres); + +//afficher(&desnombres,affichage); + +return 0; +} diff --git a/projets/projetsfile/Testliste/test.o b/projets/projetsfile/Testliste/test.o new file mode 100644 index 0000000..cee60ab Binary files /dev/null and b/projets/projetsfile/Testliste/test.o differ diff --git a/projets/projetsfile/scores.txt b/projets/projetsfile/scores.txt new file mode 100644 index 0000000..10f19a0 Binary files /dev/null and b/projets/projetsfile/scores.txt differ diff --git a/projets/projetslistechainee/Centipede/Makefile b/projets/projetslistechainee/Centipede/Makefile new file mode 100644 index 0000000..6b28b6e --- /dev/null +++ b/projets/projetslistechainee/Centipede/Makefile @@ -0,0 +1,13 @@ +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +BIBLIOTHEQUES = -L ../Liste -lListe -L ../Graphique -lgraph +EXECUTABLE = centipede +CFLAGS += -Wall -I ../Liste -I ../Graphique + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJETS) + $(CC) -o $@ $^ $(BIBLIOTHEQUES) -lSDL + +clean: + rm -rf $(EXECUTABLE) *.o diff --git a/projets/projetslistechainee/Centipede/centipede b/projets/projetslistechainee/Centipede/centipede new file mode 100755 index 0000000..dbaa8a6 Binary files /dev/null and b/projets/projetslistechainee/Centipede/centipede differ diff --git a/projets/projetslistechainee/Centipede/progprinc.c b/projets/projetslistechainee/Centipede/progprinc.c new file mode 100644 index 0000000..9ca0771 --- /dev/null +++ b/projets/projetslistechainee/Centipede/progprinc.c @@ -0,0 +1,302 @@ +#include +#include +#include +#include +#include +#include +#include +#define MAX_ELEMENTS 50 + +typedef struct { + char pseudo[MAX_ELEMENTS]; + char score; +}scorejoueur; + +typedef struct { + scorejoueur classement[10]; +}classement; + +typedef struct { + int x; + int y; +}position; + +typedef struct { + position contenu[MAX_ELEMENTS]; + int nombre; + } liste_poly; + + +void creationgrille(){ +int i; +for(i = 0 ; i < 20; i++) + { + rectanglePlein(i*50,0,1,1000,5); //pose de la grille + rectanglePlein(0,i*50,1000,1,5); + } } + + +void affichage(element_t e) +{ + position *p = e; + printf("%d %d \n", p->x, p->y); +} + + +void creerchampignons(int n,liste_poly *muschrooms,int champi){ + position poschampi; + int i,w; + int test=0; + for(w=0;wcontenu[i].x == poschampi.x && muschrooms->contenu[i].y == poschampi.y ) test=1; + } + if((poschampi.y > 570 || poschampi.y < 430) && test==0) + { + muschrooms->contenu[muschrooms->nombre++]=poschampi; + afficherLutin(champi,(muschrooms->contenu[w].x)+1,(muschrooms->contenu[w].y)+6); + } + else w--; + test = 0; + } +} + + +void creationcenti(Liste *liste,int Teted, int Corpsd) { + int x,y=500; + for(x = 300 ; x <= 450 ; x=x+50) { // fonction pour la creation centipede liste chainée + insertion(liste, x, y); + afficherLutin(Corpsd,x,y); } + x = 500; + afficherLutin(Teted,x,y); + insertion(liste, x, y); +} + + +int main() { + SDL_keysym* detail; + srand(time(NULL)); + char touche; + unsigned char bas; + int largeur = 1000; + int hauteur = 1000; + char *titre = "Le Centipede"; + scorejoueur scorefait={.pseudo={'\0'}}; + scorejoueur autres; + scorejoueur lecture; + classement ranking; + + int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); + int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); + int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); + int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); + int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); + int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); + int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); + int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); + int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); + int gameover = chargerLutin("Lutins/game_over.bmp",0); + int level1 = chargerLutin("Lutins/level1.bmp",0); + int level2 = chargerLutin("Lutins/level2.bmp",0); + int level3 = chargerLutin("Lutins/level3.bmp",0); + int levelclr = chargerLutin("Lutins/level_cleared.bmp",0); + int youwin = chargerLutin("Lutins/youwin.bmp",0); + int Tete; + int Corps; + int i; + int abs, ord, obstacle=0, couleur,level=1,speed=5000,total=0,nombrechampis=6, s,nvx,nvy,abscenti,ordcenti,absqueue,ordqueue,ecriture=1,j,w; + + if(champi<0 || Teted<0 || Teteg<0 || Teteh <0 || Teteb<0 || Corpsg<0 || Corpsd<0 || Corpsh<0 || Corpsb<0 || gameover<0 || level1<0 || level2<0 || level3<0 || levelclr<0 || youwin<0){ printf("Image pas là\n"); exit(-1); } + + creerSurface(largeur,hauteur,titre); + majSurface(); + int gomme = creerLutin(0,0,50,50,-1); + +while(level<=3) { + + liste_poly muschrooms={.nombre=0}; + Liste *maListe = initialisation(); + int w,t,compteur=0,allonge; + + rectanglePlein(0,0,1000,1000,1); + rectanglePlein(0,0,1000,1000,1); + + + if(level==1) { afficherLutin(level1,250,250); majSurface(); sleep(1); } + if(level==2) { afficherLutin(level2,250,250); majSurface(); sleep(1); } + if(level==3) { afficherLutin(level3,250,250); majSurface(); sleep(1); } + + rectanglePlein(0,0,1000,1000,1); + rectanglePlein(0,0,1000,1000,1); + + creationcenti(maListe,Teted,Corpsd); + + creerchampignons(nombrechampis,&muschrooms,champi); + + majSurface(); + + attendreEvenement(); + + s = 0; + t = 0; + + while(1){ + + for(i=0;isym==SDLK_RIGHT) t=0; + if(detail->sym==SDLK_UP) t=1; + if(detail->sym==SDLK_LEFT) t=2; + if(detail->sym==SDLK_DOWN) t=3; + } + + usleep(1); + } + if((t==0 && s!=2) || s==0) { abs=50; ord=0; Tete = Teted; Corps = Corpsd; s=0; } + if((t==1 && s!=3) || s==1) { abs=0; ord=(-50); Tete = Teteh; Corps = Corpsh; s=1; } + if((t==2 && s!=0) || s==2) { abs=-50; ord=0; Tete = Teteg; Corps = Corpsg; s=2; } + if((t==3 && s!=1) || s==3) { abs=0; ord=50; Tete = Teteb; Corps = Corpsb; s=3; } + + abscenti = abstete(maListe); + ordcenti = ordtete(maListe); + nvx = abscenti+abs; + nvy = ordcenti+ord; + if(nvx==1000 || nvy==1000 || nvx==-50 || nvy==-50) + { + afficherLutin(gameover,250,433); + majSurface(); + sleep(5); + break; + } + + majSurface(); + couleur = couleurPixel(nvx+25,nvy+25); + if(couleur!=1) obstacle = 1; + else obstacle = 0; + allonge = 0; + + + if(obstacle==1){ + for(w=0;wautres.score) + { + fseek(fichier,-sizeof(scorefait),SEEK_CUR); + fwrite(&scorefait,sizeof(scorefait),1,fichier); + } + ecriture=0; + break; + } + ecriture=1; + } + if(ecriture==1) {fwrite(&scorefait,sizeof(scorefait),1,fichier);} + } + rewind(fichier); + while((fread(&lecture,sizeof(lecture),1,fichier)!=0)) + { + for(w=0;w<10;w++) + { + if(lecture.score>ranking.classement[w].score) + { + for(j=10;j>w;j--) + { + strcpy(ranking.classement[j].pseudo,ranking.classement[j-1].pseudo); // gestion et affichage classement + ranking.classement[j].score=ranking.classement[j-1].score; + } + strcpy(ranking.classement[w].pseudo,lecture.pseudo); + ranking.classement[w].score=lecture.score; + break; + } + } + } + printf("RANKING :\n"); + for(w=0;w<10;w++) + { + printf("%i : %s , score : %d\n",w+1,ranking.classement[w].pseudo,ranking.classement[w].score); + } + fclose(fichier); + + return 0; +} + + diff --git a/projets/projetslistechainee/Centipede/progprinc.c~ b/projets/projetslistechainee/Centipede/progprinc.c~ new file mode 100644 index 0000000..2ba8b95 --- /dev/null +++ b/projets/projetslistechainee/Centipede/progprinc.c~ @@ -0,0 +1,304 @@ +#include +#include +#include +#include +#include +#include +#include +#define MAX_ELEMENTS 50 + +typedef struct { + char pseudo[MAX_ELEMENTS]; + char score; +}scorejoueur; + +typedef struct { + scorejoueur classement[10]; +}classement; + +typedef struct { + int x; + int y; +}position; + +typedef struct { + position contenu[MAX_ELEMENTS]; + int nombre; + } liste_poly; + + +void creationgrille(){ +int i; +for(i = 0 ; i < 20; i++) + { + rectanglePlein(i*50,0,1,1000,5); //pose de la grille + rectanglePlein(0,i*50,1000,1,5); + } } + + +void affichage(element_t e) +{ + position *p = e; + printf("%d %d \n", p->x, p->y); +} + + +void creerchampignons(int n,liste_poly *muschrooms,int champi){ + position poschampi; + int i,w; + int test=0; + for(w=0;wcontenu[i].x == poschampi.x && muschrooms->contenu[i].y == poschampi.y ) test=1; + } + if((poschampi.y > 570 || poschampi.y < 430) && test==0) + { + muschrooms->contenu[muschrooms->nombre++]=poschampi; + afficherLutin(champi,(muschrooms->contenu[w].x)+1,(muschrooms->contenu[w].y)+6); + } + else w--; + test = 0; + } +} + + +void creationcenti(Liste *liste,int Teted, int Corpsd) { + int x,y=500; + for(x = 300 ; x <= 450 ; x=x+50) { // fonction pour la creation centipede liste chainée + insertion(liste, x, y); + afficherLutin(Corpsd,x,y); } + x = 500; + afficherLutin(Teted,x,y); + insertion(liste, x, y); +} + + +int main() { + SDL_keysym* detail; + srand(time(NULL)); + char touche; + unsigned char bas; + int largeur = 1000; + int hauteur = 1000; + char *titre = "Le Centipede"; + position *pos; + position posmillepatte; + scorejoueur scorefait={.pseudo={'\0'}}; + scorejoueur autres; + scorejoueur lecture; + classement ranking; + + int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); + int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); + int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); + int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); + int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); + int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); + int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); + int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); + int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); + int gameover = chargerLutin("Lutins/game_over.bmp",0); + int level1 = chargerLutin("Lutins/level1.bmp",0); + int level2 = chargerLutin("Lutins/level2.bmp",0); + int level3 = chargerLutin("Lutins/level3.bmp",0); + int levelclr = chargerLutin("Lutins/level_cleared.bmp",0); + int youwin = chargerLutin("Lutins/youwin.bmp",0); + int Tete; + int Corps; + int i; + int abs, ord, obstacle=0, couleur,level=1,speed=5000,total=0,nombrechampis=6, s,nvx,nvy,abscenti,ordcenti,absqueue,ordqueue,ecriture=1,j,w; + + if(champi<0 || Teted<0 || Teteg<0 || Teteh <0 || Teteb<0 || Corpsg<0 || Corpsd<0 || Corpsh<0 || Corpsb<0 || gameover<0 || level1<0 || level2<0 || level3<0 || levelclr<0 || youwin<0){ printf("Image pas là\n"); exit(-1); } + + creerSurface(largeur,hauteur,titre); + majSurface(); + int gomme = creerLutin(0,0,50,50,-1); + +while(level<=3) { + + liste_poly muschrooms={.nombre=0}; + Liste *maListe = initialisation(); + int w,t,compteur=0,allonge; + + rectanglePlein(0,0,1000,1000,1); + rectanglePlein(0,0,1000,1000,1); + + + if(level==1) { afficherLutin(level1,250,250); majSurface(); sleep(1); } + if(level==2) { afficherLutin(level2,250,250); majSurface(); sleep(1); } + if(level==3) { afficherLutin(level3,250,250); majSurface(); sleep(1); } + + rectanglePlein(0,0,1000,1000,1); + rectanglePlein(0,0,1000,1000,1); + + creationcenti(maListe,Teted,Corpsd); + + creerchampignons(nombrechampis,&muschrooms,champi); + + majSurface(); + + attendreEvenement(); + + s = 0; + t = 0; + + while(1){ + + for(i=0;isym==SDLK_RIGHT) t=0; + if(detail->sym==SDLK_UP) t=1; + if(detail->sym==SDLK_LEFT) t=2; + if(detail->sym==SDLK_DOWN) t=3; + } + + usleep(1); + } + if((t==0 && s!=2) || s==0) { abs=50; ord=0; Tete = Teted; Corps = Corpsd; s=0; } + if((t==1 && s!=3) || s==1) { abs=0; ord=(-50); Tete = Teteh; Corps = Corpsh; s=1; } + if((t==2 && s!=0) || s==2) { abs=-50; ord=0; Tete = Teteg; Corps = Corpsg; s=2; } + if((t==3 && s!=1) || s==3) { abs=0; ord=50; Tete = Teteb; Corps = Corpsb; s=3; } + + abscenti = abstete(maListe); + ordcenti = ordtete(maListe); + nvx = abscenti+abs; + nvy = ordcenti+ord; + if(nvx==1000 || nvy==1000 || nvx==-50 || nvy==-50) + { + afficherLutin(gameover,250,433); + majSurface(); + sleep(5); + break; + } + + majSurface(); + couleur = couleurPixel(nvx+25,nvy+25); + if(couleur!=1) obstacle = 1; + else obstacle = 0; + allonge = 0; + + + if(obstacle==1){ + for(w=0;wautres.score) + { + fseek(fichier,-sizeof(scorefait),SEEK_CUR); + fwrite(&scorefait,sizeof(scorefait),1,fichier); + } + ecriture=0; + break; + } + ecriture=1; + } + if(ecriture==1) {fwrite(&scorefait,sizeof(scorefait),1,fichier);} + } + rewind(fichier); + while((fread(&lecture,sizeof(lecture),1,fichier)!=0)) + { + for(w=0;w<10;w++) + { + if(lecture.score>ranking.classement[w].score) + { + for(j=10;j>w;j--) + { + strcpy(ranking.classement[j].pseudo,ranking.classement[j-1].pseudo); // gestion et affichage classement + ranking.classement[j].score=ranking.classement[j-1].score; + } + strcpy(ranking.classement[w].pseudo,lecture.pseudo); + ranking.classement[w].score=lecture.score; + break; + } + } + } + printf("RANKING :\n"); + for(w=0;w<10;w++) + { + printf("%i : %s , score : %d\n",w+1,ranking.classement[w].pseudo,ranking.classement[w].score); + } + fclose(fichier); + + return 0; +} + + diff --git a/projets/projetslistechainee/Centipede/progprinc.o b/projets/projetslistechainee/Centipede/progprinc.o new file mode 100644 index 0000000..7e5d16f Binary files /dev/null and b/projets/projetslistechainee/Centipede/progprinc.o differ diff --git a/projets/projetslistechainee/Graphique/Makefile b/projets/projetslistechainee/Graphique/Makefile new file mode 100644 index 0000000..5791d72 --- /dev/null +++ b/projets/projetslistechainee/Graphique/Makefile @@ -0,0 +1,29 @@ +# +# Makefile pour la bibliotheque graphique +# + +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +CIBLE = libgraph.a + +# +# Nom de la cible principale +# + +all: $(CIBLE) + +# +# Cible de nettoyage +# + +clean: + rm -f core *.o $(CIBLE) + +# +# Dependances pour la bibliotheque +# + +$(CIBLE): $(OBJETS) + $(AR) rs $@ $? + +$(CIBLE:.a=).o: $(CIBLE:.a=).c $(CIBLE:.a=).h diff --git a/projets/projetslistechainee/Graphique/libgraph.a b/projets/projetslistechainee/Graphique/libgraph.a new file mode 100644 index 0000000..5b977e8 Binary files /dev/null and b/projets/projetslistechainee/Graphique/libgraph.a differ diff --git a/projets/projetslistechainee/Graphique/libgraph.c b/projets/projetslistechainee/Graphique/libgraph.c new file mode 100644 index 0000000..bff8b0f --- /dev/null +++ b/projets/projetslistechainee/Graphique/libgraph.c @@ -0,0 +1,180 @@ +/**** Bibliotheque graphique ****/ + +/** Fichiers d'inclusion **/ + +#include + +#include "libgraph.h" + +/** Types **/ + +typedef struct { int r,v,b; } couleur; + +/** Constantes **/ + +#define BITS_PAR_PIXEL 32 + +static const couleur couleurs[]={ + {255,255,255}, + {0,0,0}, + {255,0,0}, + {0,255,0}, + {0,0,255}, + {255,105,180}, + {150,150,150}, + {-1,-1,-1} + }; + +/** Variables globales **/ + +static SDL_Surface *surface; + +/** Fonctions **/ + +/* Initialisation de la surface dessinable */ + +unsigned char creerSurface(int largeur,int hauteur,char *titre){ +SDL_Init(SDL_INIT_VIDEO); +SDL_WM_SetCaption(titre,titre); +surface=SDL_SetVideoMode(largeur,hauteur,BITS_PAR_PIXEL,SDL_DOUBLEBUF); +return (surface!=NULL); +} + +/* Fermeture de la surface dessinable */ + +void fermerSurface(void){ +if(surface!=NULL) SDL_FreeSurface(surface); +SDL_Quit(); +} + +/* Creation d'une couleur */ + +static int creerCouleur(int ncouleur){ +couleur c=couleurs[ncouleur]; +return SDL_MapRGB(surface->format,c.r,c.v,c.b); +} + +/* Dessin d'un rectangle plein */ + +void rectanglePlein(int x,int y,int l,int h,int c){ +SDL_Rect rectangle={x,y,l,h}; +SDL_FillRect(surface,&rectangle,creerCouleur(c)); +//SDL_Flip(surface); +} + +/* Manipulation de lutins */ + +static SDL_Surface *lutins[MAX_LUTINS]; +static int lutins_nb=0; + +static void configurerLutin(SDL_Surface *lutin,int ncouleur){ +couleur c=couleurs[ncouleur]; +int fond=SDL_MapRGB(lutin->format,c.r,c.v,c.b); +SDL_SetColorKey(lutin,SDL_SRCCOLORKEY|SDL_RLEACCEL,fond); +} + +int chargerLutin(char *fichier,int couleur){ +if(lutins_nb>=MAX_LUTINS) return -2; +SDL_Surface *lutin=SDL_LoadBMP(fichier); +if(lutin!=NULL){ + lutins[lutins_nb++]=lutin; + if(couleur>=0) configurerLutin(lutin,couleur); + return lutins_nb-1; + } +return -1; +} + +void afficherLutin(int lutin,int x,int y){ +SDL_Rect position; +position.x=x; +position.y=y; +SDL_BlitSurface(lutins[lutin],NULL,surface,&position); +} + +int creerLutin(int x,int y,int largeur,int hauteur,int couleur){ +if(lutins_nb>=MAX_LUTINS) return -2; +int rmask,gmask,bmask,amask; +#if SDL_BYTEORDER == SDL_BIG_ENDIAN +rmask=0xff000000; gmask=0x00ff0000; bmask=0x0000ff00; amask=0x000000ff; +#else +rmask=0x000000ff; gmask=0x0000ff00; bmask=0x00ff0000; amask=0xff000000; +#endif +if(couleur<0) amask=0x00000000; +SDL_Surface *lutin=SDL_CreateRGBSurface(0,largeur,hauteur,BITS_PAR_PIXEL,rmask,gmask,bmask,amask); +SDL_Rect fenetre; +fenetre.x=x; +fenetre.y=y; +fenetre.h=hauteur; +fenetre.w=largeur; +SDL_BlitSurface(surface,&fenetre,lutin,NULL); +lutins[lutins_nb++]=lutin; +if(couleur>=0) configurerLutin(lutin,couleur); +return lutins_nb-1; +} + +void tailleLutin(int lutin,int *largeur,int *hauteur){ +*largeur=lutins[lutin]->w; +*hauteur=lutins[lutin]->h; +} + +int sauverLutin(int lutin,char *nom){ return SDL_SaveBMP(lutins[lutin],nom); } + +/* Manipulation de copie de surface en BMP */ + +int sauverSurface(char *fichier){ return SDL_SaveBMP(surface,fichier); } + +unsigned char chargerSurface(char *fichier){ +SDL_Surface *image=SDL_LoadBMP(fichier); +if(image!=NULL){ + SDL_BlitSurface(image,NULL,surface,NULL); + SDL_Flip(surface); + } +return (image!=NULL); +} + +void majSurface(void){ SDL_Flip(surface); } + +/* Trouver la couleur d'un pixel */ + +int couleurPixel(int x,int y){ +int bpp=surface->format->BytesPerPixel; +Uint32 *p=(Uint32 *)(surface->pixels+y*surface->pitch+x*bpp); +Uint8 r,v,b; +SDL_GetRGB(*p,surface->format,&r,&v,&b); +int i=0; +while(1){ + if(couleurs[i].r<0) break; + if(r==couleurs[i].r && v==couleurs[i].v && b==couleurs[i].b) break; + i++; + } +if(couleurs[i].r<0) return -1; else return i; +} + +/* Fonction de traitement des événements */ + +unsigned char lireTouche(unsigned char *bas,char *touche,void **detail){ +static SDL_keysym _detail; +SDL_Event event; +while(SDL_PollEvent(&event)){ + if(event.type==SDL_KEYDOWN || event.type==SDL_KEYUP){ + *bas=(event.type==SDL_KEYDOWN)?1:0; + char* nom=SDL_GetKeyName(event.key.keysym.sym); + if(strlen(nom)==1 && nom[0]>=32 && nom[0]<128) *touche=nom[0]; else *touche=0; + _detail=event.key.keysym; + *detail=&_detail; + return 1; + } + } +return 0; +} + +void attendreEvenement(void){ +SDL_Event event; +while(SDL_WaitEvent(&event)) + switch(event.type){ + case SDL_KEYDOWN: + case SDL_MOUSEBUTTONDOWN: + case SDL_QUIT: + return; + } +} diff --git a/projets/projetslistechainee/Graphique/libgraph.h b/projets/projetslistechainee/Graphique/libgraph.h new file mode 100644 index 0000000..e0e7097 --- /dev/null +++ b/projets/projetslistechainee/Graphique/libgraph.h @@ -0,0 +1,33 @@ +/**** Bibliotheque graphique (definitions) ****/ + +/** Constantes **/ + +#define COULEUR_BLANC 0 +#define COULEUR_NOIR 1 +#define COULEUR_ROUGE 2 +#define COULEUR_VERT 3 +#define COULEUR_BLEU 4 +#define COULEUR_ROSE 5 +#define COULEUR_GRIS 6 + +#define MAX_LUTINS 16 + +/** Prototypes **/ + +unsigned char creerSurface(int largeur,int hauteur,char *titre); +unsigned char chargerSurface(char *fichier); +int sauverSurface(char *fichier); +void majSurface(void); +void fermerSurface(void); + +void rectanglePlein(int x,int y,int l,int h,int c); +int couleurPixel(int x,int y); + +int chargerLutin(char *fichier,int couleur); +void afficherLutin(int lutin,int x,int y); +int creerLutin(int x,int y,int largeur,int hauteur,int couleur); +int sauverLutin(int lutin,char *nom); +void tailleLutin(int lutin,int *largeur,int *hauteur); + +unsigned char lireTouche(unsigned char *bas,char *touche,void **detail); +void attendreEvenement(void); diff --git a/projets/projetslistechainee/Graphique/libgraph.o b/projets/projetslistechainee/Graphique/libgraph.o new file mode 100644 index 0000000..3d91fea Binary files /dev/null and b/projets/projetslistechainee/Graphique/libgraph.o differ diff --git a/projets/projetslistechainee/Liste/.directory b/projets/projetslistechainee/Liste/.directory new file mode 100644 index 0000000..e8d027c --- /dev/null +++ b/projets/projetslistechainee/Liste/.directory @@ -0,0 +1,6 @@ +[Dolphin] +Timestamp=2016,6,17,14,20,55 +Version=3 + +[Settings] +HiddenFilesShown=true diff --git a/projets/projetslistechainee/Liste/Makefile b/projets/projetslistechainee/Liste/Makefile new file mode 100644 index 0000000..7a639be --- /dev/null +++ b/projets/projetslistechainee/Liste/Makefile @@ -0,0 +1,29 @@ +# +# Makefile pour la bibliotheque graphique +# + +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +CIBLE = libListe.a + +# +# Nom de la cible principale +# + +all: $(CIBLE) + +# +# Cible de nettoyage +# + +clean: + rm -f core *.o $(CIBLE) + +# +# Dependances pour la bibliotheque +# + +$(CIBLE): $(OBJETS) + $(AR) rs $@ $? + +$(CIBLE:.a=).o: $(CIBLE:.a=).c $(CIBLE:.a=).h diff --git a/projets/projetslistechainee/Liste/a.out b/projets/projetslistechainee/Liste/a.out new file mode 100755 index 0000000..2acc058 Binary files /dev/null and b/projets/projetslistechainee/Liste/a.out differ diff --git a/projets/projetslistechainee/Liste/libFile.c b/projets/projetslistechainee/Liste/libFile.c new file mode 100644 index 0000000..8e7e860 --- /dev/null +++ b/projets/projetslistechainee/Liste/libFile.c @@ -0,0 +1,192 @@ +#include +#include +#include "libFile.h" +#include + +// Fonctions pour projets avec file + +int taille(liste_t *l) +{ + return l->nombre; +} + +int enfiler (liste_t *l, element_t e, int taille){ +element_t nouveau=malloc(taille); +memcpy(nouveau,e,taille); +if (l->nombre >= l->alloue) + { + l->contenu = realloc(l->contenu, (l->alloue+300)*sizeof(element_t)); + l->alloue+=300; + } +l->contenu[l->nombre++]=nouveau; +return 0; +} + + + +int afficher(liste_t *l, void(*affichage)(element_t)) { +int i; +for(i=0; icontenu[i]); +return 0; +} + +int defiler(liste_t *l) +{ + int i; + + if(taille(l)>=1) + { + free(l->contenu[0]); + for(i=0; i < taille(l); i++) + { + l->contenu[i]=l->contenu[i+1]; + } + l->nombre--; + } + return 0; +} + +element_t premier(liste_t *l) { + return l->contenu[0]; } + +element_t dernier(liste_t *l) { + return l->contenu[(l->nombre)-1];} + +element_t enieme(int x, liste_t *l) { + return l->contenu[x]; +} + +// Fonctions pour liste chainée + + +Liste *initialisation() +{ + Liste *liste = malloc(sizeof(*liste)); + Element *element = malloc(sizeof(*element)); + + if (liste == NULL || element == NULL) + { + exit(EXIT_FAILURE); + } + element->x =0; + element->y =0; + + element->suivant = NULL; + liste->premier = element; + liste->nbelements =0; + + return liste; +} + +void insertion(Liste *liste, int x, int y) +{ + /* Création du nouvel élément */ + Element *nouveau = malloc(sizeof(*nouveau)); + if (liste == NULL || nouveau == NULL) + { + exit(EXIT_FAILURE); + } + nouveau->x = x; + nouveau->y = y; + + /* Insertion de l'élément au début de la liste */ + nouveau->suivant = liste->premier; + liste->premier = nouveau; + liste->nbelements=liste->nbelements+1; +} + +void afficherListe(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + Element *actuel = liste->premier; + + while (actuel != NULL) + { + printf("combinaison x,y : %d , %d \n", actuel->x,actuel->y); + actuel = actuel->suivant; + } +} + +void suppression(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + if (liste->premier != NULL) + { + Element *aSupprimer = liste->premier; + liste->premier = liste->premier->suivant; + free(aSupprimer); + } +} + +int abstete(Liste *liste){ + + Element *actuel = liste->premier; + return actuel->x; + +} + +int tailledelachaine(Liste *liste) { + + return liste->nbelements; + +} + + +int ordtete(Liste *liste) { + Element *actuel = liste->premier; + return actuel->y; +} + +int abscul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->x; +} + +int ordcul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->y; +} + + +void freelastbloc(Liste *liste) { + int i; + Element *actuel = liste->premier; + for(i=1; inbelements-1; i++){ + actuel = actuel->suivant; + } + Element *asupprimer = actuel->suivant; + free(asupprimer); + actuel->suivant = NULL; + liste->nbelements = liste->nbelements-1; +} + + +void freeListe(Liste *liste){ + while(liste->premier!=NULL) suppression(liste); +} + + + + + + + + diff --git a/projets/projetslistechainee/Liste/libFile.c~ b/projets/projetslistechainee/Liste/libFile.c~ new file mode 100644 index 0000000..8e7e860 --- /dev/null +++ b/projets/projetslistechainee/Liste/libFile.c~ @@ -0,0 +1,192 @@ +#include +#include +#include "libFile.h" +#include + +// Fonctions pour projets avec file + +int taille(liste_t *l) +{ + return l->nombre; +} + +int enfiler (liste_t *l, element_t e, int taille){ +element_t nouveau=malloc(taille); +memcpy(nouveau,e,taille); +if (l->nombre >= l->alloue) + { + l->contenu = realloc(l->contenu, (l->alloue+300)*sizeof(element_t)); + l->alloue+=300; + } +l->contenu[l->nombre++]=nouveau; +return 0; +} + + + +int afficher(liste_t *l, void(*affichage)(element_t)) { +int i; +for(i=0; icontenu[i]); +return 0; +} + +int defiler(liste_t *l) +{ + int i; + + if(taille(l)>=1) + { + free(l->contenu[0]); + for(i=0; i < taille(l); i++) + { + l->contenu[i]=l->contenu[i+1]; + } + l->nombre--; + } + return 0; +} + +element_t premier(liste_t *l) { + return l->contenu[0]; } + +element_t dernier(liste_t *l) { + return l->contenu[(l->nombre)-1];} + +element_t enieme(int x, liste_t *l) { + return l->contenu[x]; +} + +// Fonctions pour liste chainée + + +Liste *initialisation() +{ + Liste *liste = malloc(sizeof(*liste)); + Element *element = malloc(sizeof(*element)); + + if (liste == NULL || element == NULL) + { + exit(EXIT_FAILURE); + } + element->x =0; + element->y =0; + + element->suivant = NULL; + liste->premier = element; + liste->nbelements =0; + + return liste; +} + +void insertion(Liste *liste, int x, int y) +{ + /* Création du nouvel élément */ + Element *nouveau = malloc(sizeof(*nouveau)); + if (liste == NULL || nouveau == NULL) + { + exit(EXIT_FAILURE); + } + nouveau->x = x; + nouveau->y = y; + + /* Insertion de l'élément au début de la liste */ + nouveau->suivant = liste->premier; + liste->premier = nouveau; + liste->nbelements=liste->nbelements+1; +} + +void afficherListe(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + Element *actuel = liste->premier; + + while (actuel != NULL) + { + printf("combinaison x,y : %d , %d \n", actuel->x,actuel->y); + actuel = actuel->suivant; + } +} + +void suppression(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + if (liste->premier != NULL) + { + Element *aSupprimer = liste->premier; + liste->premier = liste->premier->suivant; + free(aSupprimer); + } +} + +int abstete(Liste *liste){ + + Element *actuel = liste->premier; + return actuel->x; + +} + +int tailledelachaine(Liste *liste) { + + return liste->nbelements; + +} + + +int ordtete(Liste *liste) { + Element *actuel = liste->premier; + return actuel->y; +} + +int abscul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->x; +} + +int ordcul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->y; +} + + +void freelastbloc(Liste *liste) { + int i; + Element *actuel = liste->premier; + for(i=1; inbelements-1; i++){ + actuel = actuel->suivant; + } + Element *asupprimer = actuel->suivant; + free(asupprimer); + actuel->suivant = NULL; + liste->nbelements = liste->nbelements-1; +} + + +void freeListe(Liste *liste){ + while(liste->premier!=NULL) suppression(liste); +} + + + + + + + + diff --git a/projets/projetslistechainee/Liste/libFile.h b/projets/projetslistechainee/Liste/libFile.h new file mode 100644 index 0000000..f447aa0 --- /dev/null +++ b/projets/projetslistechainee/Liste/libFile.h @@ -0,0 +1,45 @@ +typedef void *element_t; + + typedef struct { + element_t *contenu; + int nombre; + int alloue; +} liste_t; + +int taille(liste_t *l); +int enfiler (liste_t *l,element_t e, int taille); +int afficher (liste_t *l, void(*affichage)(element_t)); +int defiler(liste_t *l); +element_t dernier(liste_t *l); +element_t premier(liste_t *l); +element_t enieme(int x, liste_t *l); + + + +typedef struct Element Element; +struct Element +{ + int x; + int y; + Element *suivant; +}; + + +typedef struct Liste Liste; +struct Liste +{ + int nbelements; + Element *premier; +}; + +Liste *initialisation(); +void insertion(Liste *liste, int x, int y); +void afficherListe(Liste *liste); +void suppression(Liste *liste); +int abstete(Liste *liste); +int tailledelachaine(Liste *liste); +int ordtete(Liste *liste); +int abscul(Liste *liste); +int ordcul(Liste *liste); +void freelastbloc(Liste *liste); +void freeListe(Liste *liste); diff --git a/projets/projetslistechainee/Liste/libFile.h~ b/projets/projetslistechainee/Liste/libFile.h~ new file mode 100644 index 0000000..117de33 --- /dev/null +++ b/projets/projetslistechainee/Liste/libFile.h~ @@ -0,0 +1,45 @@ +typedef void *element_t; + + typedef struct { + element_t *contenu; + int nombre; + int alloue; +} liste_t; + +int taille(liste_t *l); +int enfiler (liste_t *l,element_t e, int taille); +int afficher (liste_t *l, void(*affichage)(element_t)); +int defiler(liste_t *l); +element_t dernier(liste_t *l); +element_t premier(liste_t *l); +element_t enieme(int x, liste_t *l); + + + +typedef struct Element Element; +struct Element +{ + int x; + int y; + Element *suivant; +}; + + +typedef struct Liste Liste; +struct Liste +{ + int nbelements; + Element *premier; +}; + +Liste *initialisation(); +void insertion(Liste *liste, int x, int y); +void afficherListe(Liste *liste); +void suppression(Liste *liste); +int abstete(Liste *liste); +int tailledelachaine(Liste *liste); +int ordtete(Liste *liste); +int abscul(Liste *liste); +int ordcul(Liste *liste); +void freelastbloc(Liste *liste); + diff --git a/projets/projetslistechainee/Liste/libFile.o b/projets/projetslistechainee/Liste/libFile.o new file mode 100644 index 0000000..8dc3731 Binary files /dev/null and b/projets/projetslistechainee/Liste/libFile.o differ diff --git a/projets/projetslistechainee/Liste/libListe.a b/projets/projetslistechainee/Liste/libListe.a new file mode 100644 index 0000000..9632b34 Binary files /dev/null and b/projets/projetslistechainee/Liste/libListe.a differ diff --git a/projets/projetslistechainee/Liste/listechainee.c b/projets/projetslistechainee/Liste/listechainee.c new file mode 100644 index 0000000..ee55426 --- /dev/null +++ b/projets/projetslistechainee/Liste/listechainee.c @@ -0,0 +1,278 @@ +#include +#include +#include + +/* typedef struct Element Element; + +struct Element + +{ + + int nombre; + + Element *suivant; + +}; + + +typedef struct Liste Liste; + +struct Liste + +{ + + Element *premier; + +}; + + +Liste *initialisation() +{ + Liste *liste = malloc(sizeof(*liste)); + Element *element = malloc(sizeof(*element)); + + if (liste == NULL || element == NULL) + { + exit(EXIT_FAILURE); + } + + element->nombre = 0; + element->suivant = NULL; + liste->premier = element; + + return liste; +} + +void insertion(Liste *liste, int nvNombre) +{ + + Element *nouveau = malloc(sizeof(*nouveau)); + if (liste == NULL || nouveau == NULL) + { + exit(EXIT_FAILURE); + } + nouveau->nombre = nvNombre; + + + nouveau->suivant = liste->premier; + liste->premier = nouveau; +} + +void afficherListe(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + Element *actuel = liste->premier; + + while (actuel != NULL) + { + printf("%d -> ", actuel->nombre); + actuel = actuel->suivant; + } + printf("NULL\n"); +} + +void suppression(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + if (liste->premier != NULL) + { + Element *aSupprimer = liste->premier; + liste->premier = liste->premier->suivant; + free(aSupprimer); + } +} */ + +typedef struct Element Element; + +struct Element + +{ + + //int nombre; + int x; + int y; + Element *suivant; + +}; + + +typedef struct Liste Liste; + +struct Liste + +{ + int nbelements; + + Element *premier; + +}; + + +Liste *initialisation() +{ + Liste *liste = malloc(sizeof(*liste)); + Element *element = malloc(sizeof(*element)); + + if (liste == NULL || element == NULL) + { + exit(EXIT_FAILURE); + } + + //element->nombre = 0; + element->x =0; + element->y =0; + + element->suivant = NULL; + liste->premier = element; + liste->nbelements =0; + + return liste; +} + +void insertion(Liste *liste, int x, int y) +{ + /* Création du nouvel élément */ + Element *nouveau = malloc(sizeof(*nouveau)); + if (liste == NULL || nouveau == NULL) + { + exit(EXIT_FAILURE); + } + nouveau->x = x; + nouveau->y = y; + + /* Insertion de l'élément au début de la liste */ + nouveau->suivant = liste->premier; + liste->premier = nouveau; + liste->nbelements=liste->nbelements+1; +} + +void afficherListe(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + Element *actuel = liste->premier; + + while (actuel != NULL) + { + printf("combinaison x,y : %d , %d \n", actuel->x,actuel->y); + actuel = actuel->suivant; + } +} + +void suppression(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + if (liste->premier != NULL) + { + Element *aSupprimer = liste->premier; + liste->premier = liste->premier->suivant; + free(aSupprimer); + } +} + +int abstete(Liste *liste){ + + Element *actuel = liste->premier; + return actuel->x; + +} + +int tailledelachaine(Liste *liste) { + + return liste->nbelements; + +} + + +int ordtete(Liste *liste) { + Element *actuel = liste->premier; + return actuel->y; +} + +int abscul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->x; +} + +int ordcul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->y; +} + + +void freelastbloc(Liste *liste) { + int i; + Element *actuel = liste->premier; + for(i=1; inbelements-1; i++){ + actuel = actuel->suivant; + } + Element *asupprimer = actuel->suivant; + free(asupprimer); + actuel->suivant = NULL; + liste->nbelements = liste->nbelements-1; +} + +void freeListe(Liste *liste){ + while(liste->premier!=NULL) suppression(liste); +} + +int main() + +{ + + Liste *maListe = initialisation(); + + + insertion(maListe, 4 , 8); + + insertion(maListe, 3 , 9); + + insertion(maListe, 7 , 12); + + insertion(maListe, 10 , 15); + + printf("\n\n\n"); + + int a = ordcul(maListe); + + printf("%d \n",a); + + freelastbloc(maListe); + + afficherListe(maListe); + + freeListe(maListe); + + printf("\n ca va free"); + + afficherListe(maListe); + +printf("\n ca a free"); + return 0; + +} diff --git a/projets/projetslistechainee/Liste/listechainee.c~ b/projets/projetslistechainee/Liste/listechainee.c~ new file mode 100644 index 0000000..09fe7ba --- /dev/null +++ b/projets/projetslistechainee/Liste/listechainee.c~ @@ -0,0 +1,275 @@ +#include +#include +#include + +/* typedef struct Element Element; + +struct Element + +{ + + int nombre; + + Element *suivant; + +}; + + +typedef struct Liste Liste; + +struct Liste + +{ + + Element *premier; + +}; + + +Liste *initialisation() +{ + Liste *liste = malloc(sizeof(*liste)); + Element *element = malloc(sizeof(*element)); + + if (liste == NULL || element == NULL) + { + exit(EXIT_FAILURE); + } + + element->nombre = 0; + element->suivant = NULL; + liste->premier = element; + + return liste; +} + +void insertion(Liste *liste, int nvNombre) +{ + + Element *nouveau = malloc(sizeof(*nouveau)); + if (liste == NULL || nouveau == NULL) + { + exit(EXIT_FAILURE); + } + nouveau->nombre = nvNombre; + + + nouveau->suivant = liste->premier; + liste->premier = nouveau; +} + +void afficherListe(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + Element *actuel = liste->premier; + + while (actuel != NULL) + { + printf("%d -> ", actuel->nombre); + actuel = actuel->suivant; + } + printf("NULL\n"); +} + +void suppression(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + if (liste->premier != NULL) + { + Element *aSupprimer = liste->premier; + liste->premier = liste->premier->suivant; + free(aSupprimer); + } +} */ + +typedef struct Element Element; + +struct Element + +{ + + //int nombre; + int x; + int y; + Element *suivant; + +}; + + +typedef struct Liste Liste; + +struct Liste + +{ + int nbelements; + + Element *premier; + +}; + + +Liste *initialisation() +{ + Liste *liste = malloc(sizeof(*liste)); + Element *element = malloc(sizeof(*element)); + + if (liste == NULL || element == NULL) + { + exit(EXIT_FAILURE); + } + + //element->nombre = 0; + element->x =0; + element->y =0; + + element->suivant = NULL; + liste->premier = element; + liste->nbelements =0; + + return liste; +} + +void insertion(Liste *liste, int x, int y) +{ + /* Création du nouvel élément */ + Element *nouveau = malloc(sizeof(*nouveau)); + if (liste == NULL || nouveau == NULL) + { + exit(EXIT_FAILURE); + } + nouveau->x = x; + nouveau->y = y; + + /* Insertion de l'élément au début de la liste */ + nouveau->suivant = liste->premier; + liste->premier = nouveau; + liste->nbelements=liste->nbelements+1; +} + +void afficherListe(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + Element *actuel = liste->premier; + + while (actuel != NULL) + { + printf("combinaison x,y : %d , %d \n", actuel->x,actuel->y); + actuel = actuel->suivant; + } +} + +void suppression(Liste *liste) +{ + if (liste == NULL) + { + exit(EXIT_FAILURE); + } + + if (liste->premier != NULL) + { + Element *aSupprimer = liste->premier; + liste->premier = liste->premier->suivant; + free(aSupprimer); + } +} + +int abstete(Liste *liste){ + + Element *actuel = liste->premier; + return actuel->x; + +} + +int tailledelachaine(Liste *liste) { + + return liste->nbelements; + +} + + +int ordtete(Liste *liste) { + Element *actuel = liste->premier; + return actuel->y; +} + +int abscul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->x; +} + +int ordcul(Liste *liste) { + Element *actuel = liste->premier; + int i; + for(i=1;inbelements;i++) + { + actuel = actuel->suivant; + } + return actuel->y; +} + + +void freelastbloc(Liste *liste) { + int i; + Element *actuel = liste->premier; + for(i=1; inbelements-1; i++){ + actuel = actuel->suivant; + } + Element *asupprimer = actuel->suivant; + free(asupprimer); + actuel->suivant = NULL; + liste->nbelements = liste->nbelements-1; +} + +void freeListe(Liste *liste){ + while(liste->premier!=NULL) suppression(liste); +} + + +int main() + +{ + + Liste *maListe = initialisation(); + + + insertion(maListe, 4 , 8); + + insertion(maListe, 3 , 9); + + insertion(maListe, 7 , 12); + + insertion(maListe, 10 , 15); + + printf("\n\n\n"); + + int a = ordcul(maListe); + + printf("%d \n",a); + + freelastbloc(maListe); + + afficherListe(maListe); + + freeListe(maListe); + + afficherListe(maListe); + return 0; + +} diff --git a/projets/projetslistechainee/Liste/listechainee.o b/projets/projetslistechainee/Liste/listechainee.o new file mode 100644 index 0000000..072ef78 Binary files /dev/null and b/projets/projetslistechainee/Liste/listechainee.o differ diff --git a/projets/projetslistechainee/Lutins/game_over.bmp b/projets/projetslistechainee/Lutins/game_over.bmp new file mode 100644 index 0000000..9320d63 Binary files /dev/null and b/projets/projetslistechainee/Lutins/game_over.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_bombe.bmp b/projets/projetslistechainee/Lutins/invader_bombe.bmp new file mode 100644 index 0000000..0b3e39b Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_bombe.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_bouclier.bmp b/projets/projetslistechainee/Lutins/invader_bouclier.bmp new file mode 100644 index 0000000..f71e3f3 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_bouclier.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_canon.bmp b/projets/projetslistechainee/Lutins/invader_canon.bmp new file mode 100644 index 0000000..2b450dd Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_canon.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_canon_ferraille.bmp b/projets/projetslistechainee/Lutins/invader_canon_ferraille.bmp new file mode 100644 index 0000000..575ec72 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_canon_ferraille.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_missile.bmp b/projets/projetslistechainee/Lutins/invader_missile.bmp new file mode 100644 index 0000000..2095002 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_missile.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre1_1.bmp b/projets/projetslistechainee/Lutins/invader_monstre1_1.bmp new file mode 100644 index 0000000..cf56472 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre1_1.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre1_2.bmp b/projets/projetslistechainee/Lutins/invader_monstre1_2.bmp new file mode 100644 index 0000000..cf56472 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre1_2.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre2_1.bmp b/projets/projetslistechainee/Lutins/invader_monstre2_1.bmp new file mode 100644 index 0000000..40bbf1f Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre2_1.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre2_2.bmp b/projets/projetslistechainee/Lutins/invader_monstre2_2.bmp new file mode 100644 index 0000000..f99ec39 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre2_2.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre3_1.bmp b/projets/projetslistechainee/Lutins/invader_monstre3_1.bmp new file mode 100644 index 0000000..a17556a Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre3_1.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre3_2.bmp b/projets/projetslistechainee/Lutins/invader_monstre3_2.bmp new file mode 100644 index 0000000..a17556a Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre3_2.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_monstre_bouillie.bmp b/projets/projetslistechainee/Lutins/invader_monstre_bouillie.bmp new file mode 100644 index 0000000..fa89282 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_monstre_bouillie.bmp differ diff --git a/projets/projetslistechainee/Lutins/invader_ovni.bmp b/projets/projetslistechainee/Lutins/invader_ovni.bmp new file mode 100644 index 0000000..da5fbd8 Binary files /dev/null and b/projets/projetslistechainee/Lutins/invader_ovni.bmp differ diff --git a/projets/projetslistechainee/Lutins/level1.bmp b/projets/projetslistechainee/Lutins/level1.bmp new file mode 100644 index 0000000..ec2f29d Binary files /dev/null and b/projets/projetslistechainee/Lutins/level1.bmp differ diff --git a/projets/projetslistechainee/Lutins/level2.bmp b/projets/projetslistechainee/Lutins/level2.bmp new file mode 100644 index 0000000..5b2e3cc Binary files /dev/null and b/projets/projetslistechainee/Lutins/level2.bmp differ diff --git a/projets/projetslistechainee/Lutins/level3.bmp b/projets/projetslistechainee/Lutins/level3.bmp new file mode 100644 index 0000000..c168bbf Binary files /dev/null and b/projets/projetslistechainee/Lutins/level3.bmp differ diff --git a/projets/projetslistechainee/Lutins/level_cleared.PNG b/projets/projetslistechainee/Lutins/level_cleared.PNG new file mode 100644 index 0000000..d74edc6 Binary files /dev/null and b/projets/projetslistechainee/Lutins/level_cleared.PNG differ diff --git a/projets/projetslistechainee/Lutins/level_cleared.bmp b/projets/projetslistechainee/Lutins/level_cleared.bmp new file mode 100644 index 0000000..b487ef8 Binary files /dev/null and b/projets/projetslistechainee/Lutins/level_cleared.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_champi.bmp b/projets/projetslistechainee/Lutins/millepatte_champi.bmp new file mode 100644 index 0000000..6126777 Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_champi.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_corps_bas.bmp b/projets/projetslistechainee/Lutins/millepatte_corps_bas.bmp new file mode 100644 index 0000000..ed4f660 Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_corps_bas.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_corps_droite.bmp b/projets/projetslistechainee/Lutins/millepatte_corps_droite.bmp new file mode 100644 index 0000000..36b049d Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_corps_droite.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_corps_gauche.bmp b/projets/projetslistechainee/Lutins/millepatte_corps_gauche.bmp new file mode 100644 index 0000000..a67092c Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_corps_gauche.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_corps_haut.bmp b/projets/projetslistechainee/Lutins/millepatte_corps_haut.bmp new file mode 100644 index 0000000..92dd3c7 Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_corps_haut.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_tete_bas.bmp b/projets/projetslistechainee/Lutins/millepatte_tete_bas.bmp new file mode 100644 index 0000000..c582ab3 Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_tete_bas.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_tete_droite.bmp b/projets/projetslistechainee/Lutins/millepatte_tete_droite.bmp new file mode 100644 index 0000000..7bce015 Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_tete_droite.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_tete_gauche.bmp b/projets/projetslistechainee/Lutins/millepatte_tete_gauche.bmp new file mode 100644 index 0000000..f94c70b Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_tete_gauche.bmp differ diff --git a/projets/projetslistechainee/Lutins/millepatte_tete_haut.bmp b/projets/projetslistechainee/Lutins/millepatte_tete_haut.bmp new file mode 100644 index 0000000..c74c0c1 Binary files /dev/null and b/projets/projetslistechainee/Lutins/millepatte_tete_haut.bmp differ diff --git a/projets/projetslistechainee/Lutins/youwin.bmp b/projets/projetslistechainee/Lutins/youwin.bmp new file mode 100644 index 0000000..450e852 Binary files /dev/null and b/projets/projetslistechainee/Lutins/youwin.bmp differ diff --git a/projets/projetslistechainee/Makefile b/projets/projetslistechainee/Makefile new file mode 100644 index 0000000..ea5eae2 --- /dev/null +++ b/projets/projetslistechainee/Makefile @@ -0,0 +1,24 @@ +REPERTOIRES = Graphique Liste Testliste Centipede +COMPILE = $(REPERTOIRES:%=all-%) +DEVERMINE = $(REPERTOIRES:%=debug-%) +NETTOYAGE = $(REPERTOIRES:%=clean-%) +export CFLAGS += -g -Wall + +all: $(COMPILE) +$(COMPILE): + $(MAKE) -C $(@:all-%=%) + +debug: $(DEVERMINE) +$(DEVERMINE): CFLAGS += -g -DDEVERMINE +$(DEVERMINE): + $(MAKE) -C $(@:debug-%=%) + +clean: $(NETTOYAGE) +$(NETTOYAGE): + $(MAKE) -C $(@:clean-%=%) clean + +all-Main: all-Bibliotheque +debug-Main: debug-Bibliotheque + +.PHONY: $(COMPILE) $(DEVERMINE) $(NETTOYAGE) +.PHONY: all debug clean diff --git a/projets/projetslistechainee/Testliste/Makefile b/projets/projetslistechainee/Testliste/Makefile new file mode 100644 index 0000000..c54edfb --- /dev/null +++ b/projets/projetslistechainee/Testliste/Makefile @@ -0,0 +1,12 @@ +SOURCES = $(wildcard *.c) +OBJETS = $(SOURCES:.c=.o) +BIBLIOTHEQUES = -L ../Liste -lListe +EXECUTABLE = projet +CFLAGS += -Wall -I ../Liste + +all: $(EXECUTABLE) +$(EXECUTABLE): $(OBJETS) + $(CC) -o $@ $^ $(BIBLIOTHEQUES) + +clean: + rm -rf $(EXECUTABLE) *.o diff --git a/projets/projetslistechainee/Testliste/projet b/projets/projetslistechainee/Testliste/projet new file mode 100644 index 0000000..9451be0 Binary files /dev/null and b/projets/projetslistechainee/Testliste/projet differ diff --git a/projets/projetslistechainee/Testliste/test.c b/projets/projetslistechainee/Testliste/test.c new file mode 100644 index 0000000..ccb65fc --- /dev/null +++ b/projets/projetslistechainee/Testliste/test.c @@ -0,0 +1,27 @@ +#include +#include +#include "libFile.h" +#include + + +int main(){ + +liste_t desnombres={NULL,0,0}; + +int petit = 10; +int moyen = 100; +int grand = 1000; + +enfiler(&desnombres,&petit,sizeof(int)); +enfiler(&desnombres,&moyen,sizeof(int)); +enfiler(&desnombres,&grand,sizeof(int)); +enfiler(&desnombres,&petit,sizeof(int)); + +//afficher(&desnombres,affichage); + +//defiler(&desnombres); + +//afficher(&desnombres,affichage); + +return 0; +} diff --git a/projets/projetslistechainee/Testliste/test.o b/projets/projetslistechainee/Testliste/test.o new file mode 100644 index 0000000..cee60ab Binary files /dev/null and b/projets/projetslistechainee/Testliste/test.o differ diff --git a/projets/projetslistechainee/scores.txt b/projets/projetslistechainee/scores.txt new file mode 100644 index 0000000..37fd8ae Binary files /dev/null and b/projets/projetslistechainee/scores.txt differ -- libgit2 0.21.2