aboutsummaryrefslogtreecommitdiff
path: root/screenbuffer.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-19 11:27:32 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-19 11:27:32 +0100
commitac500f4a786d975b492cc879bf6195a066b0a398 (patch)
tree66f8015b78ba3e57f02cbe1af0bd76425155c22f /screenbuffer.h
parent5c61d5f9c3b21df1a41de6960a9e67f21805bdc2 (diff)
Add colours to terminal sim output
Diffstat (limited to 'screenbuffer.h')
-rw-r--r--screenbuffer.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/screenbuffer.h b/screenbuffer.h
index 7a2883e..a461145 100644
--- a/screenbuffer.h
+++ b/screenbuffer.h
@@ -6,13 +6,26 @@ using namespace std;
class ScreenBuffer{
+ struct Style{
+ int fg=9,bg=9;
+ };
+
+ struct Cell{
+ char c=' ';
+ Style style;
+ };
+
int W,H;
- char *prevscreen,*screen;
+ Cell *prevscreen,*screen;
int curx=0,cury=0;
+ Style curstyle;
void printstr(const char *buf);
int printf_varargs(const char *format,va_list ap);
+ friend bool operator!=(const ScreenBuffer::Style &a,const ScreenBuffer::Style &b);
+ friend bool operator!=(const ScreenBuffer::Cell &a,const ScreenBuffer::Cell &b);
+
public:
ScreenBuffer(int W,int H);
~ScreenBuffer();
@@ -21,6 +34,9 @@ public:
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 setfg(int fg);
+ void setbg(int bg);
+
void draw();
void emergencyDeinit();