summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-28 00:31:06 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-28 00:31:06 +0300
commit8611b3c1ea3316bfc4740149b8f41c35dacee7c1 (patch)
treed2af4e3af305ea451ed4072d52b45212ddc3c884 /src/gui
parent81b52381745a96fcbae36aa744585ac1a1ff5d18 (diff)
downloadplus-8611b3c1ea3316bfc4740149b8f41c35dacee7c1.tar.gz
plus-8611b3c1ea3316bfc4740149b8f41c35dacee7c1.tar.bz2
plus-8611b3c1ea3316bfc4740149b8f41c35dacee7c1.tar.xz
plus-8611b3c1ea3316bfc4740149b8f41c35dacee7c1.zip
Change texture order drawing in item containers.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp20
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp21
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp22
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp16
4 files changed, 54 insertions, 25 deletions
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 167ba2b5a..af3b78a31 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -103,21 +103,27 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics)
graphics->setFont(getFont());
+ if (mBackgroundImg)
+ {
+ for (unsigned i = 0; i < mMaxItems; i++)
+ {
+ g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth,
+ (i / mGridWidth) * mBoxHeight);
+ }
+ }
+
+ Inventory *inv = PlayerInfo::getInventory();
+ if (!inv)
+ return;
+
for (unsigned i = 0; i < mMaxItems; i++)
{
const int itemX = (i % mGridWidth) * mBoxWidth;
const int itemY = (i / mGridWidth) * mBoxHeight;
- if (mBackgroundImg)
- g->drawImage(mBackgroundImg, itemX, itemY);
-
if (dropShortcut->getItem(i) < 0)
continue;
- Inventory *inv = PlayerInfo::getInventory();
- if (!inv)
- return;
-
Item *item = inv->findItem(dropShortcut->getItem(i),
dropShortcut->getItemColor(i));
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index f1f040966..aaf22c066 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -109,23 +109,34 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
graphics->setFont(getFont());
+ if (mBackgroundImg)
+ {
+ for (unsigned i = 0; i < mMaxItems; i++)
+ {
+ g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth,
+ (i / mGridWidth) * mBoxHeight);
+ }
+ }
+
for (unsigned i = 0; i < mMaxItems; i++)
{
const int emoteX = (i % mGridWidth) * mBoxWidth;
const int emoteY = (i / mGridWidth) * mBoxHeight;
- if (mBackgroundImg)
- g->drawImage(mBackgroundImg, emoteX, emoteY);
-
// Draw emote keyboard shortcut.
std::string key = inputManager.getKeyValueString(
Input::KEY_EMOTE_1 + i);
graphics->setColor(getForegroundColor());
g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT);
-
+ }
+ for (unsigned i = 0; i < mMaxItems; i++)
+ {
if (i < mEmoteImg.size() && mEmoteImg[i] && mEmoteImg[i]->sprite)
- mEmoteImg[i]->sprite->draw(g, emoteX + 2, emoteY + 10);
+ {
+ mEmoteImg[i]->sprite->draw(g, (i % mGridWidth) * mBoxWidth + 2,
+ (i / mGridWidth) * mBoxHeight + 10);
+ }
}
if (mEmoteMoved && mEmoteMoved < static_cast<unsigned>(
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 4d9e6dd2d..0585f59cd 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -113,14 +113,24 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
graphics->setFont(getFont());
+ if (mBackgroundImg)
+ {
+ for (unsigned i = 0; i < mMaxItems; i++)
+ {
+ g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth,
+ (i / mGridWidth) * mBoxHeight);
+ }
+ }
+
+ Inventory *inv = PlayerInfo::getInventory();
+ if (!inv)
+ return;
+
for (unsigned i = 0; i < mMaxItems; i++)
{
const int itemX = (i % mGridWidth) * mBoxWidth;
const int itemY = (i / mGridWidth) * mBoxHeight;
- if (mBackgroundImg)
- g->drawImage(mBackgroundImg, itemX, itemY);
-
// Draw item keyboard shortcut.
std::string key = inputManager.getKeyValueString(
Input::KEY_SHORTCUT_1 + i);
@@ -137,11 +147,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
// this is item
if (itemId < SPELL_MIN_ID)
{
- if (!PlayerInfo::getInventory())
- continue;
-
- Item *item = PlayerInfo::getInventory()->findItem(
- itemId, itemColor);
+ Item *item = inv->findItem(itemId, itemColor);
if (item)
{
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 07ecbfaf0..7818dc8dc 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -111,20 +111,26 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
int selectedId = spellShortcut->getSelectedItem();
g->setColor(getForegroundColor());
+ if (mBackgroundImg)
+ {
+ for (unsigned i = 0; i < mMaxItems; i++)
+ {
+ g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth,
+ (i / mGridWidth) * mBoxHeight);
+ }
+ }
+
for (unsigned i = 0; i < mMaxItems; i++)
{
const int itemX = (i % mGridWidth) * mBoxWidth;
const int itemY = (i / mGridWidth) * mBoxHeight;
- g->drawImage(mBackgroundImg, itemX, itemY);
-
int itemId = spellShortcut->getItem(
(mNumber * SPELL_SHORTCUT_ITEMS) + i);
if (selectedId >= 0 && itemId == selectedId)
{
- g->drawRectangle(gcn::Rectangle(
- itemX + 1, itemY + 1,
- mBoxWidth - 1, mBoxHeight - 1));
+ g->drawRectangle(gcn::Rectangle(itemX + 1, itemY + 1,
+ mBoxWidth - 1, mBoxHeight - 1));
}
if (!spellManager)