summaryrefslogtreecommitdiff
path: root/src/screen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.cpp')
-rw-r--r--src/screen.cpp49
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;
+}