summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2023-03-13 14:01:40 +0000
committerIan C <ianc@noddybox.co.uk>2023-03-13 14:01:40 +0000
commita91c8129a58419a2c8d6d80682566059f58fe5d7 (patch)
tree53bca564b01ba1bcce64268a5b0fbf50eda0007d
parent1d07a8fcc9a4cf20fd44ca5e26184d4022321818 (diff)
Small tweak to WinSceen
-rw-r--r--util.c24
-rw-r--r--util.h1
2 files changed, 24 insertions, 1 deletions
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();
}
diff --git a/util.h b/util.h
index cc00b85..44fe10e 100644
--- a/util.h
+++ b/util.h
@@ -31,6 +31,7 @@
void Fatal(const char *p);
void Centre(int y, const char *p);
+void CentreSkipSpaces(int y, const char *p);
const char *CardName(Card c);
void DrawCard(int y, int x, int face_down, Card c);
double DRand();