Fixed game stats screen #20

This commit is contained in:
2017-05-22 21:30:38 +02:00
parent 359e55de4b
commit 8bd852ad8b
2 changed files with 19 additions and 7 deletions

View File

@@ -223,6 +223,7 @@ void drawGuessWord(game_state *gs) {
}
rows++;
}
gs->wordRows = rows; //set the number of rows for clearing the screen later
tempstartpos = xcounter = gs->centerx - (gs->wordLength / rows);
}
@@ -327,14 +328,15 @@ int checkWin(game_state *gs) {
void printGameStats(game_state *gs) {
//clear();
int i;
int i, z;
double diff;
diff = difftime(gs->endTime, gs->startTime);
for (i = 0; i < gs->maxx; i++) {
mvprintw(gs->centery, i, " ");
mvprintw(gs->centery + 1, i, " ");
}
for (z = 0; z <= gs->wordRows; z++) { //<= takes the last row too
for (i = 0; i < gs->maxx; i++) {
mvprintw(gs->centery + z, i, " ");
//mvprintw(gs->centery + 1, i, " ");
}
}
if (gs->moves >= gs->allowedMoves) {
mvprintw(gs->centery, gs->centerx - 10, "Game lost. Solution:");
mvprintw(gs->centery + 1, gs->centerx - (gs->wordLength / 2), gs->guessWord);
@@ -445,5 +447,14 @@ void drawFigure(game_state *gs, int drawNext) {
}
void lala(void) {
int c;
if ((c = getch()) == 10) {
c *= 5;
}
}