aboutsummaryrefslogtreecommitdiff
path: root/screenbuffer.h
blob: 7a2883eb0bc78166c0f23db69a359b4f64541d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <cstdarg>

using namespace std;


class ScreenBuffer{
	int W,H;
	char *prevscreen,*screen;
	int curx=0,cury=0;

	void printstr(const char *buf);
	int printf_varargs(const char *format,va_list ap);

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();
};