diff options
author | Cara Salter <cara@devcara.com> | 2023-01-07 23:24:04 -0500 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2023-01-07 23:24:04 -0500 |
commit | 36d4f4741cd2559362de7e64820ca4b29b022121 (patch) | |
tree | 172537aa08f946e2a6dc65bc4bec40985f6e1f95 /src/screen.cpp | |
download | cpp-rl-master.tar.gz cpp-rl-master.zip |
Diffstat (limited to 'src/screen.cpp')
-rw-r--r-- | src/screen.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/screen.cpp b/src/screen.cpp new file mode 100644 index 0000000..9bff98f --- /dev/null +++ b/src/screen.cpp @@ -0,0 +1,49 @@ +/* + * ===================================================================================== + * + * Filename: screen.cpp + * + * Description: Defines an NCurses screen + * + * Version: 1.0 + * Created: 01/07/2023 09:52:27 PM + * Revision: none + * Compiler: gcc + * + * Author: Cara Salter (muirrum), cara@devcara.com + * Organization: + * + * ===================================================================================== + */ + +#include <ncurses.h> +#include <stdlib.h> +#include "screen.hpp" + +Screen::Screen() { + initscr(); + clear(); + noecho(); + cbreak(); + keypad(stdscr, TRUE); + curs_set(0); + + getmaxyx(stdscr, _height, _width); +} + +Screen::~Screen() { + endwin(); +} + +// Print a message +void Screen::add(const char* message) { + printw(message); +} + +int Screen::height() { + return _height; +} + +int Screen::width() { + return _width; +} |