summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-12 01:37:05 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-12 01:37:05 +0300
commitebb73f6dd78ecd616cbb56cf426d43cfcb3e3dd2 (patch)
treef4f54a4794cab34d1366f32b90a7fc6d44f074c6 /src/gui
parent5bab162bfa65fddfca94e67c930dfb01dee576fa (diff)
downloadmanaplus-ebb73f6dd78ecd616cbb56cf426d43cfcb3e3dd2.tar.gz
manaplus-ebb73f6dd78ecd616cbb56cf426d43cfcb3e3dd2.tar.bz2
manaplus-ebb73f6dd78ecd616cbb56cf426d43cfcb3e3dd2.tar.xz
manaplus-ebb73f6dd78ecd616cbb56cf426d43cfcb3e3dd2.zip
Add new parameters to equipment window tehming.
New parameters: itemPadding - ofset in pixels from left top corner or item box boxSize - slot item box size (by default 36 px)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/equipmentwindow.cpp26
-rw-r--r--src/gui/equipmentwindow.h2
2 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index b40a73afd..5b5c8d1d1 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -47,10 +47,6 @@
#include "debug.h"
-static const int BOX_WIDTH = 36;
-static const int BOX_HEIGHT = 36;
-static const int BOX_X_PAD = (BOX_WIDTH - 32) / 2;
-static const int BOX_Y_PAD = (BOX_HEIGHT - 32) / 2;
static const int BOX_COUNT = 13;
EquipmentWindow::EquipmentWindow(Equipment *const equipment,
@@ -68,11 +64,16 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment,
mBeing(being),
mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)),
mBorderColor(Theme::getThemeColor(Theme::BORDER)),
- mLabelsColor(Theme::getThemeColor(Theme::LABEL))
+ mLabelsColor(Theme::getThemeColor(Theme::LABEL)),
+ mItemPadding(getOption("itemPadding")),
+ mBoxSize(getOption("boxSize"))
{
if (setupWindow)
setupWindow->registerWindowForReset(this);
+ if (!mBoxSize)
+ mBoxSize = 36;
+
// Control that shows the Player
mPlayerBox->setDimension(gcn::Rectangle(50, 80, 74, 168));
mPlayerBox->setPlayer(being);
@@ -176,20 +177,21 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
{
image->setAlpha(1.0f); // Ensure the image is drawn
// with maximum opacity
- g->drawImage(image, box->x + 2, box->y + 2);
+ g->drawImage(image, box->x + mItemPadding,
+ box->y + mItemPadding);
if (i == EQUIP_PROJECTILE_SLOT)
{
g->setColor(mLabelsColor);
graphics->drawText(toString(item->getQuantity()),
- box->x + (BOX_WIDTH / 2), box->y - fontHeight,
+ box->x + (mBoxSize / 2), box->y - fontHeight,
gcn::Graphics::CENTER);
}
}
}
else if (box->image)
{
- g->drawImage(box->image, box->x + BOX_X_PAD,
- box->y + BOX_Y_PAD);
+ g->drawImage(box->image, box->x + mItemPadding,
+ box->y + mItemPadding);
}
}
}
@@ -220,8 +222,7 @@ Item *EquipmentWindow::getItem(const int x, const int y) const
const EquipmentBox *const box = *it;
if (!box)
continue;
- const gcn::Rectangle tRect(box->x, box->y,
- BOX_WIDTH, BOX_HEIGHT);
+ const gcn::Rectangle tRect(box->x, box->y, mBoxSize, mBoxSize);
if (tRect.isPointInRect(x, y))
return mEquipment->getEquipment(i);
@@ -253,8 +254,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
if (!box)
continue;
const Item *const item = mEquipment->getEquipment(i);
- const gcn::Rectangle tRect(box->x, box->y,
- BOX_WIDTH, BOX_HEIGHT);
+ const gcn::Rectangle tRect(box->x, box->y, mBoxSize, mBoxSize);
if (tRect.isPointInRect(x, y) && item)
setSelected(i);
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 6a7158922..4d20a8447 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -142,6 +142,8 @@ class EquipmentWindow final : public Window, public gcn::ActionListener
gcn::Color mLabelsColor;
Image *mSlotBackground;
Image *mSlotHighlightedBackground;
+ int mItemPadding;
+ int mBoxSize;
};
extern EquipmentWindow *equipmentWindow;