2 #include "textpainter.h"
3 #include "support/LOstream.h"
6 TextPainter::TextPainter(int xmax, int ymax)
7 : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
11 char & TextPainter::at(int x, int y)
13 return data_[y * xmax_ + x];
17 char TextPainter::at(int x, int y) const
19 return data_[y * xmax_ + x];
23 void TextPainter::draw(int x, int y, char const * str)
25 //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
26 for (int i = 0; *str && x + i < xmax_; ++i, ++str)
32 void TextPainter::horizontalLine(int x, int y, int n, char c)
34 for (int i = 0; i < n && i + x < xmax_; ++i)
39 void TextPainter::verticalLine(int x, int y, int n, char c)
41 for (int i = 0; i < n && i + y < ymax_; ++i)
46 void TextPainter::draw(int x, int y, char c)
48 //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
54 void TextPainter::show(std::ostream & os, int offset) const
57 for (int j = 0; j <= ymax_; ++j) {
58 for (int i = 0; i < offset; ++i)
60 for (int i = 0; i < xmax_; ++i)