Worms -- OOP Redo
2016-01
Worms-Redo Project as a learning vehicle.
Main Page
Related Pages
Classes
Files
File List
File Members
ncurses.cpp
Go to the documentation of this file.
1
2
/* ncurses */
3
4
#include <ncurses.h>
5
6
void
endCurses
()
7
{
8
if
(!isendwin())
9
endwin();
10
}
11
12
void
startCurses
()
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
}
30
31
int
getOneChar
()
32
{
33
nodelay(stdscr, FALSE);
// wait until a char is typed
34
int
c =
getChar
();
35
nodelay(stdscr, TRUE);
36
return
c;
37
}
38
39
// ncurses code ends here
asogRows
int asogRows
Definition:
display.cpp:18
MAXrow
#define MAXrow
Definition:
display.cpp:14
MAXcol
#define MAXcol
Definition:
display.cpp:15
asogCols
int asogCols
Definition:
display.cpp:18
endCurses
void endCurses()
Definition:
ncurses.cpp:6
getChar
#define getChar()
Definition:
worms.h:28
startCurses
void startCurses()
Definition:
ncurses.cpp:12
getOneChar
int getOneChar()
Definition:
ncurses.cpp:31
Generated on Thu May 19 2016 15:14:16 for Worms -- OOP Redo by
1.8.11