Worms -- OOP Redo  2016-01
Worms-Redo Project as a learning vehicle.
Functions
ncurses.cpp File Reference
#include <ncurses.h>
Include dependency graph for ncurses.cpp:

Go to the source code of this file.

Functions

void endCurses ()
 
int getOneChar ()
 
void startCurses ()
 

Function Documentation

void endCurses ( )

Definition at line 6 of file ncurses.cpp.

Referenced by startCurses().

7 {
8  if (!isendwin())
9  endwin();
10 }
int getOneChar ( )

Definition at line 31 of file ncurses.cpp.

References getChar.

32 {
33  nodelay(stdscr, FALSE); // wait until a char is typed
34  int c = getChar();
35  nodelay(stdscr, TRUE);
36  return c;
37 }
#define getChar()
Definition: worms.h:28
void startCurses ( )

Definition at line 12 of file ncurses.cpp.

References asogCols, asogRows, endCurses(), MAXcol, and MAXrow.

13 {
14  initscr(); // ncurses init
15  cbreak(); // unbuffered getChar
16  noecho(); // no echoing of keys pressed
17  // intrflush(stdscr, 0); // TBD
18  nodelay(stdscr, TRUE); // get a char *if* available
19  atexit(endCurses);
20  start_color();
21  use_default_colors();
22  init_pair(1, COLOR_RED, -1);
23  init_pair(2, COLOR_GREEN, -1);
24  init_pair(3, COLOR_BLUE, -1);
25  getmaxyx(stdscr, asogRows, asogCols);
26  if (asogCols > MAXcol) asogCols = MAXcol;
27  if (asogRows > MAXrow) asogRows = MAXrow;
28  asogRows -= 6; // 6 lines for msgs, asogRows needs to be > 0
29 }
int asogRows
Definition: display.cpp:18
#define MAXrow
Definition: display.cpp:14
#define MAXcol
Definition: display.cpp:15
int asogCols
Definition: display.cpp:18
void endCurses()
Definition: ncurses.cpp:6