git-svn-id: svn://db.shs.com.ru/pip@247 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -187,7 +187,7 @@ void PIKbdListener::readKeyboard() {
|
||||
if (alt) ke.modifiers |= Alt;
|
||||
//if (meta) ke.modifiers |= Meta;
|
||||
if (ker.dwControlKeyState & CAPSLOCK_ON) shift = !shift;
|
||||
//cout << "key " << int(ker.wVirtualKeyCode) << endl;
|
||||
//piCout << "key" << int(ker.wVirtualKeyCode) << int(ker.uChar.AsciiChar);
|
||||
switch (ker.wVirtualKeyCode) {
|
||||
case 8: ret = 1; ke.key = Backspace; break;
|
||||
case 33: ret = 1; ke.key = PageUp; break;
|
||||
|
||||
@@ -169,4 +169,10 @@ private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIKbdListener::KeyEvent & v) {s << v.key << int(v.modifiers); return s;}
|
||||
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIKbdListener::KeyEvent & v) {int m(0); s >> v.key >> m; v.modifiers = m; return s;}
|
||||
|
||||
|
||||
#endif // PIKBDLISTENER_H
|
||||
|
||||
@@ -76,8 +76,7 @@ PIScreenDrawer::PIScreenDrawer(PIVector<PIVector<Cell> > & c): cells(c) {
|
||||
|
||||
|
||||
void PIScreenDrawer::clear() {
|
||||
for (int i = 0; i < cells.size_s(); ++i)
|
||||
cells[i].fill(Cell());
|
||||
clear(cells);
|
||||
}
|
||||
|
||||
|
||||
@@ -215,6 +214,30 @@ void PIScreenDrawer::fillRect(int x0, int y0, int x1, int y1, const PIChar & c,
|
||||
}
|
||||
|
||||
|
||||
void PIScreenDrawer::fillRect(int x0, int y0, int x1, int y1, PIVector<PIVector<Cell> > & content) {
|
||||
if (x0 > x1) piSwap(x0, x1);
|
||||
if (y0 > y1) piSwap(y0, y1);
|
||||
int w = x1 - x0;
|
||||
int h = y1 - y0;
|
||||
for (int j = y0; j != h; ++j)
|
||||
if (j >= 0 && j < piMini(height, content.size_s())) {
|
||||
if ((j + y0) >= 0 && (j + y0) < height) {
|
||||
PIVector<Cell> & cv(cells[y0 + j]);
|
||||
PIVector<Cell> & contv(content[j]);
|
||||
for (int i = 0; i != piMini(w, contv.size_s()); ++i)
|
||||
if ((i + x0) >= 0 && (i + x0) < width)
|
||||
cv[x0 + i] = contv[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PIScreenDrawer::clear(PIVector<PIVector<Cell> > & cells) {
|
||||
for (int i = 0; i < cells.size_s(); ++i)
|
||||
cells[i].fill(Cell());
|
||||
}
|
||||
|
||||
|
||||
void PIScreenDrawer::drawText(int x, int y, const PIString & s, Color col_char, Color col_back, CharFlags flags_char) {
|
||||
if (x < 0 || x >= width || y < 0 || y >= height) return;
|
||||
PIVector<Cell> & cv(cells[y]);
|
||||
|
||||
@@ -41,9 +41,12 @@ public:
|
||||
void drawFrame(int x0, int y0, int x1, int y1, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void drawText(int x, int y, const PIString & s, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Transparent, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void fillRect(int x0, int y0, int x1, int y1, const PIChar & c, PIScreenTypes::Color col_char = PIScreenTypes::Default, PIScreenTypes::Color col_back = PIScreenTypes::Default, PIScreenTypes::CharFlags flags_char = 0);
|
||||
void fillRect(int x0, int y0, int x1, int y1, PIVector<PIVector<PIScreenTypes::Cell> > & content);
|
||||
|
||||
PIChar artChar(const ArtChar type) const {return arts_.value(type, PIChar(' '));}
|
||||
|
||||
|
||||
static void clear(PIVector<PIVector<PIScreenTypes::Cell> > & cells);
|
||||
|
||||
private:
|
||||
PIVector<PIVector<PIScreenTypes::Cell> > & cells;
|
||||
int width, height;
|
||||
|
||||
@@ -138,7 +138,12 @@ namespace PIScreenTypes {
|
||||
virtual void tileSetFocusInternal(PIScreenTile * ) {}
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIScreenTypes::Cell & v) {s << v.symbol << v.format.raw_format; return s;}
|
||||
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIScreenTypes::Cell & v) {s >> v.symbol >> v.format.raw_format; return s;}
|
||||
|
||||
|
||||
#endif // PISCREENTYPES_H
|
||||
|
||||
Reference in New Issue
Block a user