diff --git a/a.exe b/a.exe new file mode 100644 index 0000000..db9f8e0 Binary files /dev/null and b/a.exe differ diff --git a/main.c b/main.c index c407021..a1bf7ad 100644 --- a/main.c +++ b/main.c @@ -5,7 +5,7 @@ int main() { - ptConf confChain = newConfChain(); + /*ptConf confChain = newConfChain(); ptListener listenerChain = newListenerChain(); addConf(confChain, "test", "tesst", 21, 120, 2023); @@ -26,7 +26,7 @@ int main() while (py -> next != NULL) { printf("name: %s\nage: %d\nlevel: %d", py -> name, py -> age, py -> level); py = py -> next; - } + }*/ menu(); diff --git a/main.exe b/main.exe index b06c1d2..d0e4955 100644 Binary files a/main.exe and b/main.exe differ diff --git a/screenManager.c b/screenManager.c index d6d70cd..17151b9 100644 --- a/screenManager.c +++ b/screenManager.c @@ -1,55 +1,136 @@ #include +#include #include #include "screenManager.h" -void menu() { - int i=0; - - ////////////////////////// Menu 1 //////////////////////////////// - - printf("\n 1/ Gestion des conferences\n 2/ Gestion des abonnes\n 3/ Participer a une conference"); +void goToCoords(int x, int y) +{ + COORD coords; + + coords.X = x; + coords.Y = y; + + SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coords); +} + +void drawRectangle(int screenX, int screenY) +{ + int lenght = screenX * 2 / 3, height = screenY * 1 / 2; + + int i; + + system("cls"); + goToCoords(screenX * 1 / 6, 3); + printf("%c", 201); + i = lenght - 2; + while (i > 0) + { + printf("%c", 205); + i--; + } + printf("%c", 187); + i = height - 2; + while (i > 0) + { + goToCoords(screenX * 1 / 6, 3 + i); + printf("%c", 186); + goToCoords(screenX * 1 / 6 + lenght - 1, 3 + i); + printf("%c", 186); + i--; + } + goToCoords(screenX * 1 / 6, 2 + height); + printf("%c", 200); + i = lenght - 2; + while (i > 0) + { + printf("%c", 205); + i--; + } + printf("%c", 188); +} + +void drawMenu(int screenX, int screenY) { + goToCoords(screenX * 1/6 + 3, 4); + printf("1/ Gestion des conferences"); + goToCoords(screenX * 1/6 + 3, 5); + printf("2/ Gestion des abonnes"); + goToCoords(screenX * 1/6 + 3, 6); + printf("3/ Participer a une conference"); + goToCoords(screenX * 1/6 + 3, 7); + printf("4/ Voir la meilleure conference"); + goToCoords(screenX * 1/6 + 3, 8); + printf("5/ Voir la participation a une conference"); + goToCoords(screenX * 1/6 + 3, 9); + printf("6/ Quitter"); +} + +void menu() +{ + CONSOLE_SCREEN_BUFFER_INFO info; + int columns, rows; + + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); + + columns = info.srWindow.Right - info.srWindow.Left + 1; + rows = info.srWindow.Bottom - info.srWindow.Top + 1; + + drawRectangle(columns, rows); + drawMenu(columns, rows); + goToCoords(0, rows / 2 + 5); + printf("Que voulez vous choisir ? "); + int choice; + scanf("%d", &choice); + +} + +/* +int i=0; + + ////////////////////////// Menu 1 //////////////////////////////// + + printf("\n 1/ Gestion des conferences\n 2/ Gestion des abonnes\n 3/ Participer a une conference"); printf("\n 4/ Voir la meilleure conference\n 5/ Voir la participation a une conference"); printf("\n 6/ Quitter\n"); - - + + scanf("%d",&i); - + ////////////////////////////////////////////////////////////////// - + switch (i){ - + //////////////////////// Menu conf ///////////////////////// - + case 1:{ printf("\n 1/ Voir la liste des conferences\n 2/ Ajouter une conference \n 3/ Suprimer une conference\n 4/ Retour\n"); break; } - + /////////////////////// Menu abonne ///////////////////////// - + case 2: { printf("\n 1/ Voir la liste des abonnes\n 2/ Ajouter un abonne \n 3/ Suprimer un abonne\n 4/ Retour\n"); break; } - + case 3: { printf("\n Nom de l'abonne : \n Nom de la conference : \n Note de la conference : "); break; } - + case 4: { printf("\n Nom : \n Note : "); break; } - - + + case 5: { printf("\n Entrer le nom de la conference : "); break; } - + case 6: { break; } } -} +*/ \ No newline at end of file