unicode strings for indicators

This commit is contained in:
Gwenhael Le Moine 2023-09-24 22:29:45 +02:00
parent 123efa0762
commit 4c469e9457
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 14 additions and 13 deletions

View file

@ -1,8 +1,8 @@
# Makefile to build x48ng without autotools
VERSION_MAJOR = 0
VERSION_MINOR = 27
PATCHLEVEL = 1
VERSION_MINOR = 28
PATCHLEVEL = 0
MAKEFLAGS +=-j$(NUM_CORES) -l$(NUM_CORES)
@ -23,8 +23,8 @@ CFLAGS += $(shell pkg-config --cflags SDL_gfx sdl12_compat)
LIBS += $(shell pkg-config --libs SDL_gfx sdl12_compat)
### Text UI
CFLAGS += $(shell pkg-config --cflags ncurses)
LIBS += $(shell pkg-config --libs ncurses)
CFLAGS += $(shell pkg-config --cflags ncursesw -DNCURSES_WIDECHAR=1)
LIBS += $(shell pkg-config --libs ncursesw)
### debugger
CFLAGS += $(shell pkg-config --cflags readline)

View file

@ -8,6 +8,7 @@
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <locale.h>
#include <ncurses.h>
@ -37,7 +38,7 @@ typedef struct tui_ann_struct_t {
int bit;
int x;
int y;
char icon;
wchar_t* icon;
} tui_ann_struct_t;
typedef struct tui_button_t {
@ -51,12 +52,12 @@ typedef struct tui_button_t {
/* variables */
/*************/
static tui_ann_struct_t ann_tbl[] = {
{ANN_LEFT, 16, 4, '<'}, /* '↰' */
{ ANN_RIGHT, 61, 4, '>'}, /* '↱ */
{ ANN_ALPHA, 106, 4, 'a'}, /* 'α' */
{ ANN_BATTERY, 151, 4, 'B'}, /* '🪫' */
{ ANN_BUSY, 196, 4, '*'}, /* '⌛' */
{ ANN_IO, 241, 4, '^'}, /* '☃' */
{ANN_LEFT, 16, 4, L"\u21b0" }, /* ↰ */
{ ANN_RIGHT, 61, 4, L"\u21b1" }, /* ↱ */
{ ANN_ALPHA, 106, 4, L"\u03b1" }, /* α */
{ ANN_BATTERY, 151, 4, L"\u1faab"}, /* 🪫 */
{ ANN_BUSY, 196, 4, L"\u231b" }, /* ⌛ */
{ ANN_IO, 241, 4, L"\u21c4" }, /* ⇄ */
/* { 0 } */
};
@ -635,13 +636,13 @@ void text_draw_annunc( void )
return;
last_annunc_state = val;
for ( int i = 0; i < 6; i++ )
mvaddch( 0, 3 + ( i * 4 ), ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? ann_tbl[ i ].icon : ' ' );
mvaddwstr( 0, 4 + ( i * 4 ), ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? ann_tbl[ i ].icon : L" " );
}
void init_text_ui( int argc, char** argv )
{
setlocale( LC_ALL, "" );
buttons = ( tui_button_t* )malloc( sizeof( buttons_gx ) );
if ( opt_gx )