mirror of
https://git.zap.org.au/git/trader.git
synced 2024-07-21 16:14:14 -04:00
Rename MIN_COLUMNS to MIN_COLS for consistency with the COLS variable
Also define WIN_COLS and WIN_LINES: the current version of Star Traders will only use this number of lines and columns in a terminal window. All calls to newwin() need to have COL_OFFSET and LINE_OFFSET added to the X and Y starting positions to make this work.
This commit is contained in:
parent
3aa98f48bd
commit
d9ff917835
@ -51,9 +51,9 @@ void init_screen (void)
|
|||||||
{
|
{
|
||||||
initscr();
|
initscr();
|
||||||
|
|
||||||
if ((COLS < MIN_COLUMNS) || (LINES < MIN_LINES)) {
|
if ((COLS < MIN_COLS) || (LINES < MIN_LINES)) {
|
||||||
err_exit("terminal size is too small (%d x %d required)",
|
err_exit("terminal size is too small (%d x %d required)",
|
||||||
MIN_COLUMNS, MIN_LINES);
|
MIN_COLS, MIN_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
noecho();
|
noecho();
|
||||||
|
14
src/intf.h
14
src/intf.h
@ -39,9 +39,21 @@
|
|||||||
* Constants and type declarations *
|
* Constants and type declarations *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#define MIN_COLUMNS (80) /* Minimum number of columns in terminal */
|
#define MIN_COLS (80) /* Minimum number of columns in terminal */
|
||||||
#define MIN_LINES (24) /* Minimum number of lines in terminal */
|
#define MIN_LINES (24) /* Minimum number of lines in terminal */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This version of Star Traders only utilises WIN_COLS x WIN_LINES of a
|
||||||
|
terminal window. COL_OFFSET and LINE_OFFSET define offsets that should
|
||||||
|
be added to each newwin() call to position the window correctly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WIN_COLS MIN_COLS /* Number of columns in main windows */
|
||||||
|
#define WIN_LINES MIN_LINES /* Number of lines in main windows */
|
||||||
|
|
||||||
|
#define COL_OFFSET ((COLS - MIN_COLS) / 2) /* Window offsets */
|
||||||
|
#define LINE_OFFSET (0)
|
||||||
|
|
||||||
#define OUTBUFSIZE (1024) /* Output string buffer size */
|
#define OUTBUFSIZE (1024) /* Output string buffer size */
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,12 +78,12 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
WINDOW *w1, *w2;
|
WINDOW *w1, *w2;
|
||||||
|
|
||||||
w1 = newwin(0, 0, 7, 0);
|
w1 = newwin(WIN_LINES - 7, WIN_COLS, LINE_OFFSET + 7, COL_OFFSET + 0);
|
||||||
wbkgd(w1, COLOR_PAIR(WHITE_ON_BLUE));
|
wbkgd(w1, COLOR_PAIR(WHITE_ON_BLUE));
|
||||||
box(w1, 0, 0);
|
box(w1, 0, 0);
|
||||||
wrefresh(w1);
|
wrefresh(w1);
|
||||||
|
|
||||||
w2 = newwin(LINES - 9, COLS - 8, 8, 4);
|
w2 = newwin(WIN_LINES - 9, WIN_COLS - 8, LINE_OFFSET + 8, COL_OFFSET + 4);
|
||||||
wbkgd(w2, COLOR_PAIR(WHITE_ON_BLUE));
|
wbkgd(w2, COLOR_PAIR(WHITE_ON_BLUE));
|
||||||
|
|
||||||
wattrset(w2, has_colors() ? COLOR_PAIR(WHITE_ON_RED) | A_BOLD : A_REVERSE | A_BOLD);
|
wattrset(w2, has_colors() ? COLOR_PAIR(WHITE_ON_RED) | A_BOLD : A_REVERSE | A_BOLD);
|
||||||
|
Loading…
Reference in New Issue
Block a user