Fixed game stats screen #20
This commit is contained in:
23
hangman.c
23
hangman.c
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
/* Defined macros */
|
||||
#define DEFAULTTRIES 6
|
||||
#define MAXWORDLENGTH 100
|
||||
#define MAXWORDLENGTH 200
|
||||
#define ALPHABET 26
|
||||
#define ALPHABET_NUM 36
|
||||
#define ANIM_DURATION 1
|
||||
@@ -28,6 +28,7 @@ typedef struct {
|
||||
char *alphabet;
|
||||
time_t startTime;
|
||||
time_t endTime;
|
||||
int wordRows;
|
||||
} game_state;
|
||||
|
||||
typedef struct word {
|
||||
|
Reference in New Issue
Block a user