build with ncursesw

Now we can display special characters and proper boxes
This commit is contained in:
Enno Rehling 2021-02-21 22:05:43 +01:00
parent a3499dd895
commit 979f2f7b6e
2 changed files with 10 additions and 8 deletions

View File

@ -42,7 +42,9 @@ endif (HAVE_LIBBSD)
endif (MSVC) endif (MSVC)
if (NOT CURSES_FOUND) if (NOT CURSES_FOUND)
find_package (Curses) set(CURSES_NEED_WIDE TRUE)
set(CURSES_NEED_NCURSES TRUE)
find_package (Curses)
endif (NOT CURSES_FOUND) endif (NOT CURSES_FOUND)
#find_package (BerkeleyDB REQUIRED) #find_package (BerkeleyDB REQUIRED)

View File

@ -4,6 +4,7 @@
#endif #endif
#endif #endif
#include <curses.h> #include <curses.h>
#define CURSES_UTF8
#include "gmtool.h" #include "gmtool.h"
#include "direction.h" #include "direction.h"
@ -58,7 +59,7 @@ state *current_state = NULL;
#define IFL_BUILDINGS (1<<3) #define IFL_BUILDINGS (1<<3)
static WINDOW *hstatus; static WINDOW *hstatus;
static int gm_utf8 = 0; /* does our curses support utf-8? */ static int gm_utf8 = 1; /* does our curses support utf-8? */
static void unicode_remove_diacritics(const char *rp, char *wp) { static void unicode_remove_diacritics(const char *rp, char *wp) {
while (*rp) { while (*rp) {
@ -107,7 +108,7 @@ int umvwaddnstr(WINDOW *w, int y, int x, const char * str, int len) {
static void init_curses(void) static void init_curses(void)
{ {
#ifdef PDCURSES #ifdef CURSES_UTF8
/* PDCurses from vcpkg is compiled with UTF8 (and WIDE) support */ /* PDCurses from vcpkg is compiled with UTF8 (and WIDE) support */
gm_utf8 = 1; gm_utf8 = 1;
#endif #endif
@ -118,7 +119,7 @@ static void init_curses(void)
short bcol = COLOR_BLACK; short bcol = COLOR_BLACK;
short hcol = COLOR_MAGENTA; short hcol = COLOR_MAGENTA;
start_color(); start_color();
#ifdef __PDCURSES__ #ifdef CURSES_UTF8
/* looks crap on putty with TERM=linux */ /* looks crap on putty with TERM=linux */
if (can_change_color()) { if (can_change_color()) {
init_color(COLOR_YELLOW, 1000, 1000, 0); init_color(COLOR_YELLOW, 1000, 1000, 0);
@ -398,8 +399,8 @@ static bool handle_info_region(window * wnd, state * st, int c)
int wxborder(WINDOW *win) int wxborder(WINDOW *win)
{ {
#ifdef __PDCURSES__ #ifdef CURSES_UTF8
return wborder(win, 0, 0, 0, 0, 0, 0, 0, 0); return box(win, 0, 0);
#else #else
return wborder(win, '|', '|', '-', '-', '+', '+', '+', '+'); return wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
#endif #endif
@ -792,8 +793,7 @@ static coordinate *region2coord(const region * r, coordinate * c)
c->pl = rplane(r); c->pl = rplane(r);
return c; return c;
} }
#ifdef PDCURSES
#ifdef __PDCURSES__
#define FAST_UP CTL_UP #define FAST_UP CTL_UP
#define FAST_DOWN CTL_DOWN #define FAST_DOWN CTL_DOWN
#define FAST_LEFT CTL_LEFT #define FAST_LEFT CTL_LEFT