forked from menault/TD3_DEV51_Qualite_Algo
		
	mince
This commit is contained in:
		| @@ -3,7 +3,7 @@ | ||||
| #include <time.h> | ||||
|  | ||||
| /* | ||||
|  | ||||
| récupère le nombre de lignes dans la banque de mots | ||||
| */ | ||||
| int getFileLength(){ | ||||
| 	/*variables*/ | ||||
| @@ -28,7 +28,7 @@ int getFileLength(){ | ||||
| } | ||||
|  | ||||
| /* | ||||
|  | ||||
| récupère un mot aléatoire dans la banque de mots | ||||
| */ | ||||
| int fetchWord(char* fullword, int file_length){ | ||||
| 	/*variables*/ | ||||
|   | ||||
							
								
								
									
										80
									
								
								interface.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								interface.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,80 @@ | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <graph.h> | ||||
|  | ||||
|  | ||||
| #define WINDOW_HEIGTH 500 | ||||
| #define WINDOW_WIDTH 500 | ||||
|  | ||||
| /* | ||||
| Contient l'ensemble des informations essentiels d'un bouton | ||||
| */ | ||||
| typedef struct { | ||||
| 	int x; | ||||
| 	int y; | ||||
| 	int length; | ||||
| 	int heigth; | ||||
| 	char* text; | ||||
| 	unsigned short int r; | ||||
| 	unsigned short int g; | ||||
| 	unsigned short int b; | ||||
| } Button; | ||||
|  | ||||
| /* | ||||
| Ouvre la fenêtre. Permet au jeu de démarer. | ||||
| */ | ||||
| void STARTGAMe(){ | ||||
| 	InitialiserGraphique(); | ||||
|     CreerFenetre(10, 10, WINDOW_HEIGTH, WINDOW_WIDTH); | ||||
| } | ||||
|  | ||||
| /* | ||||
| Vérifie si le curseur est placée dans un bouton. Renvoi 0 si oui. Renvoi -1 sinon. | ||||
| */ | ||||
| int inButton(Button* b){ | ||||
| 	int minimum_x = b->x; | ||||
| 	int minimum_y = b->y; | ||||
| 	int maximum_x = (b->x) + (b->length); | ||||
| 	int maximum_y = (b->y) + (b->heigth);  | ||||
| 	if((_X>=minimum_x)&&(_X<=maximum_x)&&(_Y>=minimum_y)&&(_Y<=maximum_y)){ | ||||
| 		return 0; | ||||
| 	} else { | ||||
| 		return -1; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /* | ||||
| Dessine un bouton sur l'écran | ||||
| */ | ||||
| void drawButton(Button* b){ | ||||
| 	ChoisirCouleurDessin(CouleurParComposante(b->r,b->g,b->b)); | ||||
| 	RemplirRectangle(b->x, b->y, b->length, b->heigth); | ||||
| 	ChoisirCouleurDessin(CouleurParNom("white")); | ||||
| 	EcrireTexte((b->x)+20, (b->y)+20, b->text, (b->heigth)/2); | ||||
| } | ||||
|  | ||||
| /* | ||||
| Affiche le menu | ||||
| */ | ||||
| void setMenu(){ | ||||
| 	/*éléments*/ | ||||
| 	Button easy = {WINDOW_WIDTH*(1-0.75), WINDOW_HEIGTH*(1-0.75), WINDOW_WIDTH/8, WINDOW_HEIGTH/10, "facile", 148, 225, 224}; | ||||
| 	Button medium = {WINDOW_WIDTH*(1-0.50), WINDOW_HEIGTH*(1-0.75), WINDOW_WIDTH/8, WINDOW_HEIGTH/10, "moyen", 148, 225, 224}; | ||||
| 	Button hard = {WINDOW_WIDTH*(1-0.25), WINDOW_HEIGTH*(1-0.75), WINDOW_WIDTH/8, WINDOW_HEIGTH/10, "difficile", 148, 225, 224}; | ||||
|  | ||||
| 	/*dessin*/ | ||||
| 	ChoisirCouleurDessin(CouleurParNom("black")); | ||||
| 	EcrireTexte(WINDOW_WIDTH/2, WINDOW_HEIGTH/2, "PENDU", WINDOW_WIDTH/10); | ||||
| 	drawButton(&easy); | ||||
| 	drawButton(&medium); | ||||
| 	drawButton(&hard); | ||||
| } | ||||
|  | ||||
|  | ||||
| int main(void){ | ||||
| 	STARTGAMe(); | ||||
| 	setMenu(); | ||||
| 	Touche(); | ||||
| 	FermerGraphique(); | ||||
| 	return EXIT_SUCCESS; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user