26 lines
540 B
C
26 lines
540 B
C
#include <string.h>
|
|
#include <ncurses.h>
|
|
#include "curseshelper.h"
|
|
|
|
void printCenter(const char *text) {
|
|
int x, y;
|
|
getmaxyx(stdscr, y, x);
|
|
|
|
int centery = --y / 2;
|
|
int centerx = (--x - (strlen(text) / 2)) / 2;
|
|
|
|
mvprintw(centery, centerx, text);
|
|
}
|
|
|
|
|
|
|
|
void printCenterOffset(const char *text, int offsety) {
|
|
int x, y;
|
|
getmaxyx(stdscr, y, x);
|
|
|
|
int centery = (--y + offsety) / 2;
|
|
int centerx = (--x - (strlen(text) / 2)) / 2;
|
|
|
|
mvprintw(centery, centerx, text);
|
|
}
|