summaryrefslogtreecommitdiff
path: root/src/gui/window.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-14 12:43:28 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-14 12:43:28 +0000
commit5a1007fa3e827c03bb86db71cb26dfd4c485f28d (patch)
treea8f114d7ae6ccb1806602b89d3ea3cf6bbfe7d83 /src/gui/window.cpp
parentcfac9a371a684a3a6f37bad725094b7e2d80a7d1 (diff)
downloadmana-5a1007fa3e827c03bb86db71cb26dfd4c485f28d.tar.gz
mana-5a1007fa3e827c03bb86db71cb26dfd4c485f28d.tar.bz2
mana-5a1007fa3e827c03bb86db71cb26dfd4c485f28d.tar.xz
mana-5a1007fa3e827c03bb86db71cb26dfd4c485f28d.zip
Extended Image with methods to get width, height and draw a pattern and made
Window widget use it.
Diffstat (limited to 'src/gui/window.cpp')
-rw-r--r--src/gui/window.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 9ab17799..d69dae77 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -24,6 +24,7 @@
#include "window.h"
#include "gui.h"
#include <guichan/allegro.hpp>
+#include "../resources/resourcemanager.h"
WindowContainer *Window::windowContainer = NULL;
@@ -48,9 +49,10 @@ Window::Window(const std::string& text, bool modal, Window *parent):
setBaseColor(gcn::Color(255, 255, 255));
// Load dialog title bar image
- dLeft = load_bitmap("data/Skin/dialogLeft.bmp", NULL);
- dMid = load_bitmap("data/Skin/dialogMiddle.bmp", NULL);
- dRight = load_bitmap("data/Skin/dialogRight.bmp", NULL);
+ ResourceManager *resman = ResourceManager::getInstance();
+ dLeft = resman->createImage("Skin/dialogLeft.bmp");
+ dMid = resman->createImage("Skin/dialogMiddle.bmp");
+ dRight = resman->createImage("Skin/dialogRight.bmp");
// Register mouse listener
addMouseListener(this);
@@ -77,9 +79,9 @@ Window::~Window()
#endif
// Free dialog bitmaps
- release_bitmap(dLeft);
- release_bitmap(dMid);
- release_bitmap(dRight);
+ //release_bitmap(dLeft);
+ //release_bitmap(dMid);
+ //release_bitmap(dRight);
delete chrome;
}
@@ -109,17 +111,16 @@ void Window::draw(gcn::Graphics* graphics)
{
gcn::AllegroGraphics *gfx = (gcn::AllegroGraphics*)graphics;
BITMAP *screen = gfx->getTarget();
- int x, y, i;
+ int x, y;
getAbsolutePosition(x, y);
// Draw title bar
- masked_blit(dLeft, screen, 0, 0, x, y, 24, 24);
- for (i = 24; i < getWidth() - 24; i += 24)
- {
- blit(dMid, screen, 0, 0, x + i, y, 24, 24);
- }
- masked_blit(dRight, screen, 0, 0,
- x + getWidth() - 24, y, 24, 24);
+ dLeft->draw(screen, x, y);
+ dMid->drawPattern(screen,
+ x + dLeft->getWidth(), y,
+ getWidth() - dLeft->getWidth() - dRight->getWidth(),
+ dMid->getHeight());
+ dRight->draw(screen, x + getWidth() - dRight->getWidth(), y);
}
else {
// Plain title bar