1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 03:33:02 +01:00

Fix a graphical bug with the game border on some terminal emulators

This commit is contained in:
jfreegman 2021-07-27 14:15:36 -04:00
parent f2b1c81279
commit d02f3b4acb
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 16 additions and 14 deletions

View File

@ -540,20 +540,20 @@ static void game_draw_border(const GameData *game, const int max_x, const int ma
const int x = (max_x - game_max_x) / 2;
const int y = (max_y - game_max_y) / 2;
wattron(win, A_BOLD | COLOR_PAIR(GAME_BORDER_COLOUR));
wattron(win, COLOR_PAIR(GAME_BORDER_COLOUR));
mvwaddch(win, y, x, ' ');
mvwhline(win, y, x + 1, ' ', game_max_x - 1);
mvwvline(win, y + 1, x, ' ', game_max_y - 1);
mvwvline(win, y, x - 1, ' ', game_max_y + 1);
mvwaddch(win, y, x + game_max_x, ' ');
mvwvline(win, y + 1, x + game_max_x, ' ', game_max_y - 1);
mvwvline(win, y, x + game_max_x + 1, ' ', game_max_y + 1);
mvwaddch(win, y + game_max_y, x, ' ');
mvwhline(win, y + game_max_y, x + 1, ' ', game_max_x - 1);
mvwaddch(win, y + game_max_y, x + game_max_x, ' ');
mvwaddch(win, y, x, ACS_ULCORNER);
mvwhline(win, y, x + 1, ACS_HLINE, game_max_x - 1);
mvwvline(win, y + 1, x, ACS_VLINE, game_max_y - 1);
mvwvline(win, y, x - 1, ACS_VLINE, game_max_y + 1);
mvwaddch(win, y, x + game_max_x, ACS_URCORNER);
mvwvline(win, y + 1, x + game_max_x, ACS_VLINE, game_max_y - 1);
mvwvline(win, y, x + game_max_x + 1, ACS_VLINE, game_max_y + 1);
mvwaddch(win, y + game_max_y, x, ACS_LLCORNER);
mvwhline(win, y + game_max_y, x + 1, ACS_HLINE, game_max_x - 1);
mvwaddch(win, y + game_max_y, x + game_max_x, ACS_LRCORNER);
wattroff(win, A_BOLD | COLOR_PAIR(GAME_BORDER_COLOUR));
wattroff(win, COLOR_PAIR(GAME_BORDER_COLOUR));
}
static void game_draw_status(const GameData *game, const int max_x, const int max_y)
@ -561,7 +561,7 @@ static void game_draw_status(const GameData *game, const int max_x, const int ma
WINDOW *win = game->window;
int x = ((max_x - game->game_max_x) / 2) - 1;
int y = ((max_y - game->game_max_y) / 2) - 1;
const int y = ((max_y - game->game_max_y) / 2) - 1;
wattron(win, A_BOLD);

View File

@ -31,7 +31,7 @@
#include "game_util.h"
#include "windows.h"
#define GAME_BORDER_COLOUR BAR_TEXT
#define GAME_BORDER_COLOUR BAR_SOLID
/* Max size of a default square game window */

View File

@ -383,6 +383,7 @@ static void init_term(void)
init_pair(BLACK_BG, COLOR_BLACK, bar_bg_color);
init_pair(PURPLE_BG, COLOR_MAGENTA, bar_bg_color);
init_pair(BAR_TEXT, bar_fg_color, bar_bg_color);
init_pair(BAR_SOLID, bar_bg_color, bar_bg_color);
init_pair(BAR_ACCENT, bar_accent_color, bar_bg_color);
init_pair(BAR_NOTIFY, bar_notify_color, bar_bg_color);
init_pair(STATUS_ONLINE, COLOR_GREEN, bar_bg_color);

View File

@ -72,6 +72,7 @@ typedef enum {
STATUS_BUSY,
STATUS_AWAY,
BAR_NOTIFY,
BAR_SOLID,
} C_COLOURS;
/* tab alert types: lower types take priority (this relies on the order of C_COLOURS) */