aboutsummaryrefslogtreecommitdiff
path: root/screenbuffer.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-02 21:23:39 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-02 21:23:39 +0100
commitfb0cdfe743869f6592090e441a071f0904a80634 (patch)
tree60a6caee28ab702efb2a3e72b6cf5644ca1949c1 /screenbuffer.h
parent39dbc1934d506f4b1da32621a8ff7e2e165a0bb0 (diff)
Optimize terminal usage
The ^C-catching stuff will not work on windows; need to look into that
Diffstat (limited to 'screenbuffer.h')
-rw-r--r--screenbuffer.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/screenbuffer.h b/screenbuffer.h
new file mode 100644
index 0000000..49cc5c5
--- /dev/null
+++ b/screenbuffer.h
@@ -0,0 +1,24 @@
+#pragma once
+
+using namespace std;
+
+
+class ScreenBuffer{
+ int W,H;
+ char *prevscreen,*screen;
+ int curx=0,cury=0;
+
+ void printstr(const char *buf);
+
+public:
+ ScreenBuffer(int W,int H);
+ ~ScreenBuffer();
+
+ void moveto(int x,int y);
+ int printf(const char *format,...) __attribute__((format (printf, 2, 3)));
+ int mvprintf(int x,int y,const char *format,...) __attribute__((format (printf, 4, 5)));
+
+ void draw();
+
+ void emergencyDeinit();
+};