diff options
Diffstat (limited to 'clicker-ncurses.c')
-rw-r--r-- | clicker-ncurses.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clicker-ncurses.c b/clicker-ncurses.c index 6adf5bf..fbcc076 100644 --- a/clicker-ncurses.c +++ b/clicker-ncurses.c @@ -46,32 +46,31 @@ main (void) /* Refresh our window to include settings above */ refresh(); + /* Initialize the structure and set the values */ struct game *cur_game = malloc(sizeof(struct game)); cur_game->click = 1; cur_game->multiplifier = 2; /* The main loop that also catches user input */ int ch = 0; - while ( ch = getch() ) + while (ch = getch()) { - if ( ch == ' ') + if (ch == ' ') { set_score(cur_game, get_score(cur_game) + get_click(cur_game)); - mvprintw(3, 1, "%d", get_score(cur_game)); } - if ( ch == 'q') + if (ch == 'q') { break; } - if ( ch == 'u') + if (ch == 'u') { if (get_score(cur_game) >= 2 * get_multiplifier(cur_game)) { set_score(cur_game, get_score(cur_game) - get_click(cur_game) * 2); set_click(cur_game, get_click(cur_game) * get_multiplifier(cur_game)); - mvprintw(3, 1, "%d", get_score(cur_game)); } } } @@ -90,6 +89,7 @@ void * set_score (struct game *game, int score) { game->score = score; + mvprintw(3, 1, "%d", game->score); } int |