1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <wchar.h>
void Locate(SHORT x, SHORT y)
{
HANDLE HMENU = GetStdHandle(STD_OUTPUT_HANDLE);
COORD Pos;
Pos.X = x;
Pos.Y = y;
SetConsoleCursorPosition(HMENU, Pos);
}
int Choix(const char* ch[],int taille,int x, int y)
{
int i,curs = 0;
Locate(x, y);
for (i = 0; i < taille; i++)
printf(" %s\n", ch[i]);
Locate(x, y);
while (1)
{
int touche = _getch();
if (touche == 0x50 && curs < taille-1)
curs++;
if (touche == 0x48 && curs > 0)
curs--;
if (touche == 0x0D)
return curs + 1;
Locate(x, y);
for (i = 0; i < taille; i++)
printf("%c\n\n", (i == curs) ? '>':' ');
}
return 0;
}
void titre(void)
{
system("CLS");
// Système
color(12,0);
printf("\n\n\n\n\t\t\t =================\n");
printf("\t\t\t | \t\t |\n");
printf("\t\t\t | Syst%cme\t |\n",138);
printf("\t\t\t | \t\t |\n");
printf("\t\t\t =================\n\n\n");
color(15,0);// Mettre la couleur par défaut "Blanc"
// Message de bienvenue !
printf("\t\t Bienvenue dans");
printf(" Gust of Wind ! \n");
printf("\t\t Le but est simple: Echappez-vous !\n\n\n\n");
Sleep(1000);
const char* tab[] = {"JOUER\n", "REGLE\n","QUITTER\n"} ; int c = Choix(tab,3,10,17);
switch(c)
{
case 1: printf("JOUER",1),Choix==1; break;
case 2: regle(); break;
case 3: printf("Quitter",3),Choix==3; break;
default: exit(-1);
}
} |
Partager