summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-25 22:42:55 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-25 22:42:55 +0000
commitfd1b18db1716144e556a4867bcd59e92edecdc58 (patch)
tree09ada126a486ffed1a8e7e39add862772c5cf07d /src/graphics.cpp
parentba5c32ee9c5c57613ec678d47c3871e9ea312402 (diff)
downloadmana-fd1b18db1716144e556a4867bcd59e92edecdc58.tar.gz
mana-fd1b18db1716144e556a4867bcd59e92edecdc58.tar.bz2
mana-fd1b18db1716144e556a4867bcd59e92edecdc58.tar.xz
mana-fd1b18db1716144e556a4867bcd59e92edecdc58.zip
Use OpenGL's translation capabilites. Small cleanups.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 47414ff0..a3299650 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -23,10 +23,6 @@
#include "graphics.h"
-#ifdef USE_OPENGL
-#include <guichan/imagefont.hpp>
-#endif
-
#include "log.h"
#include "graphic/imagerect.h"
@@ -184,37 +180,40 @@ void Graphics::drawImageRect(
Image *bottom, Image *left,
Image *center)
{
+ pushClipArea(gcn::Rectangle(x, y, w, h));
+
// Draw the center area
drawImagePattern(center,
- x + topLeft->getWidth(), y + topLeft->getHeight(),
+ topLeft->getWidth(), topLeft->getHeight(),
w - topLeft->getWidth() - topRight->getWidth(),
h - topLeft->getHeight() - bottomLeft->getHeight());
// Draw the sides
drawImagePattern(top,
- x + topLeft->getWidth(), y,
- w - topLeft->getWidth() - topRight->getWidth(), top->getHeight());
+ left->getWidth(), 0,
+ w - left->getWidth() - right->getWidth(), top->getHeight());
drawImagePattern(bottom,
- x + bottomLeft->getWidth(), y + h - bottom->getHeight(),
- w - bottomLeft->getWidth() - bottomRight->getWidth(),
+ left->getWidth(), h - bottom->getHeight(),
+ w - left->getWidth() - right->getWidth(),
bottom->getHeight());
drawImagePattern(left,
- x, y + topLeft->getHeight(),
+ 0, top->getHeight(),
left->getWidth(),
- h - topLeft->getHeight() - bottomLeft->getHeight());
+ h - top->getHeight() - bottom->getHeight());
drawImagePattern(right,
- x + w - right->getWidth(), y + topRight->getHeight(),
+ w - right->getWidth(), top->getHeight(),
right->getWidth(),
- h - topRight->getHeight() - bottomRight->getHeight());
+ h - top->getHeight() - bottom->getHeight());
// Draw the corners
- drawImage(topLeft, x, y);
- drawImage(topLeft, x, y);
- drawImage(topRight, x + w - topRight->getWidth(), y);
- drawImage(bottomLeft, x, y + h - bottomLeft->getHeight());
+ drawImage(topLeft, 0, 0);
+ drawImage(topRight, w - topRight->getWidth(), 0);
+ drawImage(bottomLeft, 0, h - bottomLeft->getHeight());
drawImage(bottomRight,
- x + w - bottomRight->getWidth(),
- y + h - bottomRight->getHeight());
+ w - bottomRight->getWidth(),
+ h - bottomRight->getHeight());
+
+ popClipArea();
}
void Graphics::drawImageRect(