diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-02-18 14:34:32 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-02-18 14:34:32 +0000 |
commit | b7d7883ff0f662836b69e132759c78142d1488c4 (patch) | |
tree | ab157ae850d682779c9b668b0321f9bc9cc68af5 /src/gui | |
parent | 3ac7f63f4ccc7c6dcd6c1b29b4da958c0ef863a6 (diff) | |
download | mana-b7d7883ff0f662836b69e132759c78142d1488c4.tar.gz mana-b7d7883ff0f662836b69e132759c78142d1488c4.tar.bz2 mana-b7d7883ff0f662836b69e132759c78142d1488c4.tar.xz mana-b7d7883ff0f662836b69e132759c78142d1488c4.zip |
Improve window borders and speed up alpha property by not setting alpha each
time the images are drawn.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/window.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index f06866d5..310da823 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -50,10 +50,10 @@ Window::Window(const std::string& text, bool modal, Window *parent): dBorders = resman->getImage("core/graphics/gui/vscroll_grey.png"); dBackground = resman->getImage("core/graphics/gui/bg_quad_dis.png"); - dUpperBorder = dBorders->getSubImage(4,0,1,3); - dLeftBorder = dBorders->getSubImage(0,4,3,1); - dRightBorder = dBorders->getSubImage(8,4,3,1); - dLowerBorder = dBorders->getSubImage(8,15,1,3); + dUpperBorder = dBorders->getSubImage(4, 0, 3, 4); + dLeftBorder = dBorders->getSubImage(0, 4, 4, 10); + dRightBorder = dBorders->getSubImage(7, 4, 4, 10); + dLowerBorder = dBorders->getSubImage(4, 15, 3, 4); dBackground->setAlpha(0.7f); dBorders->setAlpha(0.7f); @@ -99,26 +99,26 @@ void Window::setWindowContainer(WindowContainer *wc) void Window::draw(gcn::Graphics* graphics) { - int x, y; getAbsolutePosition(x, y); // Draw the background - dBackground->drawPattern(screen, x, y, getWidth(), getHeight()); + dBackground->drawPattern( + screen, x + 4, y + 4, getWidth() - 8, getHeight() - 8); + // Draw the borders - dBorders->draw(screen, 0, 0, x-1, y-1, 4, 4); // Top-Left - dBorders->draw(screen, 7, 0, x+getWidth()-3, y-1, 4, 4); // Top-Right - dBorders->draw(screen, 7, 15, x+getWidth()-3, y+getHeight()-3, 4, 4); // Bottom-Right - dBorders->draw(screen, 0, 15, x-1, y+getHeight()-3, 4, 4); // Bottom-Left + dBorders->draw(screen, 0, 0, x, y, 4, 4); // Top-Left + dBorders->draw(screen, 7, 0, x + getWidth() - 4, y, 4, 4); // Top-Right + dBorders->draw(screen, 7, 15, + x + getWidth() - 4, y + getHeight() - 4, 4, 4); // Bottom-Right + dBorders->draw(screen, 0, 15, x, y + getHeight() - 4, 4, 4); // Bottom-Left - // Upper Border - dUpperBorder->drawPattern(screen, x+3, y-1, getWidth()-4-2, 3); - // Left Border - dLeftBorder->drawPattern(screen, x-1, y+3, 3, getHeight()-4-2); - // Right Border - dRightBorder->drawPattern(screen, x+getWidth()-2, y+3, 3, getHeight()-4-2); - // Lower Border - dLowerBorder->drawPattern(screen, x+3, y+getHeight()-2, getWidth()-4-2, 3); + dUpperBorder->drawPattern(screen, x + 4, y, getWidth() - 8, 4); + dLeftBorder->drawPattern(screen, x, y + 4, 4, getHeight() - 8); + dRightBorder->drawPattern( + screen, x + getWidth() - 4, y + 4, 4, getHeight() - 8); + dLowerBorder->drawPattern( + screen, x + 4, y + getHeight() - 4, getWidth() - 8, 4); // Draw title graphics->setFont(getFont()); |