Skip to content
Snippets Groups Projects
Commit c5341462 authored by tanguy.cavagna's avatar tanguy.cavagna :desktop:
Browse files

Added window too small clause for gameboard

parent 1f6f5b97
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,9 @@ void hide_help() {
void printw_center(char *foo, int line) { mvaddstr(line, TERM_MID_COLS - (strlen(foo) / 2), foo); }
void draw_title(int id) {
if (window_too_small())
return;
for (int i = 0; i < TITLES_LINE_COUNT; i++) {
switch (id) {
case MAIN_TITLE_ID:
......@@ -240,7 +243,7 @@ void show_gameboard(int tries_count, int word_length, char **tries, int **valida
for (int j = 0; j < word_length; j++) {
// Placeholder
if (tries[i][j] == '\0') {
mvaddch(GAMEBOARD_Y_OFFSET + i, TERM_MID_COLS - word_length + (j * 2), '_');
mvaddch(GAMEBOARD_Y_OFFSET + i - menu_offset_modifer() + 5, TERM_MID_COLS - word_length + (j * 2), '_');
continue;
}
......@@ -250,13 +253,13 @@ void show_gameboard(int tries_count, int word_length, char **tries, int **valida
if (validations[i][j] == 2)
attron(COLOR_PAIR(GREEN_PAIR));
mvaddch(GAMEBOARD_Y_OFFSET + i, TERM_MID_COLS - word_length + (j * 2), tries[i][j]);
mvaddch(GAMEBOARD_Y_OFFSET + i - menu_offset_modifer() + 5, TERM_MID_COLS - word_length + (j * 2), tries[i][j]);
attroff(COLOR_PAIR(GREEN_PAIR));
attroff(COLOR_PAIR(ORANGE_PAIR));
}
}
move(GAMEBOARD_Y_OFFSET - 2, TERM_MID_COLS - word_length - 3);
move(GAMEBOARD_Y_OFFSET - 2 - menu_offset_modifer() + 5, TERM_MID_COLS - word_length - 3);
printw("Score: %d", score);
refresh();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment