From 36d4f4741cd2559362de7e64820ca4b29b022121 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Sat, 7 Jan 2023 23:24:04 -0500 Subject: Initial commit --- src/screen.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/screen.cpp (limited to 'src/screen.cpp') 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 +#include +#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; +} -- cgit v1.2.3