From a91c8129a58419a2c8d6d80682566059f58fe5d7 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 13 Mar 2023 14:01:40 +0000 Subject: Small tweak to WinSceen --- util.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'util.c') diff --git a/util.c b/util.c index 2d7e9ba..308636c 100644 --- a/util.c +++ b/util.c @@ -43,6 +43,28 @@ void Centre(int y, const char *p) mvaddstr(y, COLS / 2 - l / 2, p); } +void CentreSkipSpaces(int y, const char *p) +{ + size_t l = strlen(p); + int x; + + x = COLS / 2 - l / 2; + + while(*p) + { + if (*p == ' ') + { + x++; + } + else + { + mvaddch(y, x++, *p); + } + + p++; + } +} + const char *CardName(Card c) { static char buff[32]; @@ -194,7 +216,7 @@ void WinScreen() } } - Centre(11, "PRESS SPACE"); + CentreSkipSpaces(11, "PRESS SPACE"); refresh(); } -- cgit v1.2.3