summaryrefslogtreecommitdiff
path: root/src/gui/button.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-16 22:35:06 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-16 22:35:06 +0000
commit12356c8b5b7002cdffaa6a737f54806f52241bfb (patch)
tree8c2f46d37296420839b5cb3b9a231b5af94b31e5 /src/gui/button.cpp
parentc6ee43355e49e4099fdb2e1b26bf29eddcee130a (diff)
downloadmana-12356c8b5b7002cdffaa6a737f54806f52241bfb.tar.gz
mana-12356c8b5b7002cdffaa6a737f54806f52241bfb.tar.bz2
mana-12356c8b5b7002cdffaa6a737f54806f52241bfb.tar.xz
mana-12356c8b5b7002cdffaa6a737f54806f52241bfb.zip
Removed datafile and configfile and any leftover old GUI drawing code.
Diffstat (limited to 'src/gui/button.cpp')
-rw-r--r--src/gui/button.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 3576b1d0..4474d6a4 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -27,6 +27,30 @@ Button::Button(const std::string& caption):
gcn::Button(caption)
{
setBorderSize(0);
+
+ // Load the skin
+ ResourceManager *resman = ResourceManager::getInstance();
+ Image *btn[4];
+ btn[0] = resman->getImage("core/graphics/gui/button.bmp");
+ btn[1] = resman->getImage("core/graphics/gui/buttonhi.bmp");
+ btn[2] = resman->getImage("core/graphics/gui/buttonpress.bmp");
+ btn[3] = resman->getImage("core/graphics/gui/button_disabled.bmp");
+ int bgridx[4] = {0, 9, 16, 25};
+ int bgridy[4] = {0, 4, 19, 24};
+ int a, x, y;
+
+ for (int mode = 0; mode < 4; mode++) {
+ a = 0;
+ for (y = 0; y < 3; y++) {
+ for (x = 0; x < 3; x++) {
+ button[mode].grid[a] = btn[mode]->getSubImage(
+ bgridx[x], bgridy[y],
+ bgridx[x + 1] - bgridx[x] + 1,
+ bgridy[y + 1] - bgridy[y] + 1);
+ a++;
+ }
+ }
+ }
}
void Button::draw(gcn::Graphics* graphics) {
@@ -48,8 +72,8 @@ void Button::draw(gcn::Graphics* graphics) {
int x, y;
getAbsolutePosition(x, y);
- draw_skinned_rect(buffer, &gui_skin.button.background[mode],
- x, y, getWidth(), getHeight());
+ ((Graphics*)graphics)->drawImageRect(x, y, getWidth(), getHeight(),
+ button[mode]);
graphics->setColor(getForegroundColor());