2012-03-29 08:31:05 +00:00
|
|
|
#include <Quickdraw.h>
|
|
|
|
#include <vector>
|
2012-03-30 08:01:55 +00:00
|
|
|
#include <string>
|
2012-03-29 08:31:05 +00:00
|
|
|
|
|
|
|
class Console
|
|
|
|
{
|
|
|
|
public:
|
2012-04-05 23:43:44 +00:00
|
|
|
Console(GrafPtr port, Rect r);
|
2012-04-08 12:45:54 +00:00
|
|
|
~Console();
|
2012-03-29 08:31:05 +00:00
|
|
|
void Draw();
|
|
|
|
void putch(char c);
|
2012-03-30 08:01:55 +00:00
|
|
|
std::string ReadLine();
|
2012-03-29 08:31:05 +00:00
|
|
|
|
|
|
|
static Console *currentInstance;
|
|
|
|
private:
|
|
|
|
GrafPtr consolePort;
|
|
|
|
Rect bounds;
|
|
|
|
|
|
|
|
std::vector<char> chars;
|
|
|
|
|
|
|
|
short cellSizeX;
|
|
|
|
short cellSizeY;
|
|
|
|
|
|
|
|
short rows, cols;
|
|
|
|
|
|
|
|
short cursorX, cursorY;
|
|
|
|
|
|
|
|
Rect CellRect(short x, short y);
|
|
|
|
void DrawCell(short x, short y);
|
|
|
|
void ScrollUp(short n = 1);
|
|
|
|
};
|
|
|
|
|