136 lines
No EOL
2.8 KiB
C
136 lines
No EOL
2.8 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <windows.h>
|
|
#include "screenManager.h"
|
|
|
|
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;
|
|
}
|
|
}
|
|
*/ |