Commit 8badac28 authored by Erwan's avatar Erwan

Ajout des controles et des regles à l'interface

parent 2f69a3df
......@@ -162,7 +162,6 @@ int main(void)
//--------------------------------------------------------------------------------------
const int screenWidth = 1280;
const int screenHeight = 800;
int fontSizeBig = screenWidth*screenHeight/30000;
int fontSizeSmall = screenWidth*screenHeight/35000;
InitWindow(screenWidth, screenHeight, "HexaSweeper - Erwan MERLY");
SetTargetFPS(60);
......@@ -267,22 +266,38 @@ int main(void)
//AFFICHAGE DE L'INTERFACE
DrawRectangle(0, screenHeight-75, screenWidth, 75, Fade(LIGHTGRAY, 0.5f));
DrawText(TextFormat("MINE FLAGGED: %d/%d", flaggedMines, nbMines), 50, screenHeight-50, fontSizeBig, GRAY);
DrawText(TextFormat("Time: %d s", (int)timeEllapsed), screenWidth-250, screenHeight-50, fontSizeBig, GRAY);
DrawText(TextFormat("MINE FLAGGED: %d/%d", flaggedMines, nbMines), 50, screenHeight-50, 35, GRAY);
DrawText(TextFormat("Time: %d s", (int)timeEllapsed), screenWidth-250, screenHeight-50, 35, GRAY);
//AFFICHAGE CONTROLES ET REGLES
DrawText("CONTROLS", screenWidth-275, 50, 35, DARKGRAY);
DrawText("LEFT CLICK - REVEAL TILE", screenWidth-350, 100, 18, LIGHTGRAY);
DrawText("RIGHT CLICK - FLAG TILE", screenWidth-350, 130, 18, LIGHTGRAY);
DrawText("MIDDLE CLICK - REVEAL NEIGHBOURS", screenWidth-350, 160, 18, LIGHTGRAY);
DrawText("RULES", screenWidth-275, 210, 35, DARKGRAY);
DrawText("NUMBER INDICATE MINES AROUND", screenWidth-350, 260, 18, LIGHTGRAY);
DrawText("FLAG ALL THE MINES TO WIN", screenWidth-350, 290, 18, LIGHTGRAY);
DrawText("TILES", screenWidth-275, 340, 35, DARKGRAY);
DrawText("DARK GRAY - NON REVEALED", screenWidth-350, 390, 18, LIGHTGRAY);
DrawText("LIGHT GRAY - REVEALED", screenWidth-350, 420, 18, LIGHTGRAY);
DrawText("GREEN - FLAGGED", screenWidth-350, 450, 18, LIGHTGRAY);
DrawText("RED - MINE", screenWidth-350, 480, 18, LIGHTGRAY);
//AFFICHAGE FIN DE PARTIE
if(lose || win){
DrawRectangle(0, screenHeight*0.55, screenWidth, screenHeight/8, Fade(GRAY, 0.8f));
if(lose){
DrawText("GAME OVER", screenWidth/2-strlen("GAME OVER")/2*fontSizeBig, screenHeight*0.58, fontSizeBig, MAROON);
DrawText("GAME OVER", screenWidth/2-strlen("GAME OVER")/2*35, screenHeight*0.58, 35, MAROON);
for(int i=0; i<nbLigneMatrice; i++){
for(int j=0; j<nbColonneMatrice; j++){
if(containsMine(i, j, matriceMines)) revelerCase(matriceMines, i, j, nbLigneMatrice, nbColonneMatrice);
}
}
}
if(win) DrawText("YOU WIN!", screenWidth/2-strlen("YOU WIN!")/2*fontSizeBig, screenHeight*0.57, fontSizeBig, LIME);
DrawText("PRESS R TO REPLAY", screenWidth/2-strlen("PRESS R TO REPLAY")/2*fontSizeSmall, screenHeight*0.62, fontSizeSmall, DARKGRAY);
if(win) DrawText("YOU WIN!", screenWidth/2-strlen("YOU WIN!")/2*35, screenHeight*0.57, 35, LIME);
DrawText("PRESS R TO REPLAY", screenWidth/2-strlen("PRESS R TO REPLAY")/2*30, screenHeight*0.62, 30, DARKGRAY);
}
EndDrawing();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment