diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-05-23 01:27:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-05-23 01:27:28 +0300 |
commit | b829d239006538b2e669f4aab191ffa5ad37af68 (patch) | |
tree | a492be3847f3e3b0704b60909313cfe55dba7ca5 /src | |
parent | 70bf45e429a649f59484968d0484a4326ed1a3e9 (diff) | |
download | manaplus-b829d239006538b2e669f4aab191ffa5ad37af68.tar.gz manaplus-b829d239006538b2e669f4aab191ffa5ad37af68.tar.bz2 manaplus-b829d239006538b2e669f4aab191ffa5ad37af68.tar.xz manaplus-b829d239006538b2e669f4aab191ffa5ad37af68.zip |
Add skin offsets for images and text in shortcut containers.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 40 | ||||
-rw-r--r-- | src/gui/widgets/shortcutcontainer.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/shortcutcontainer.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/virtshortcutcontainer.cpp | 8 |
6 files changed, 68 insertions, 24 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index caa9150c1..ad597ee60 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -111,8 +111,8 @@ void EmoteShortcutContainer::draw(Graphics *restrict graphics) restrict2 if (sprite != nullptr) { sprite->draw(graphics, - (i % mGridWidth) * mBoxWidth + 2, - (i / mGridWidth) * mBoxHeight + 10); + (i % mGridWidth) * mBoxWidth + mImageOffsetX, + (i / mGridWidth) * mBoxHeight + mImageOffsetY); } } } @@ -129,7 +129,8 @@ void EmoteShortcutContainer::draw(Graphics *restrict graphics) restrict2 mForegroundColor, mForegroundColor2, key, - emoteX + 2, emoteY + 2); + emoteX + mTextOffsetX, + emoteY + mTextOffsetY); } BLOCK_END("EmoteShortcutContainer::draw") @@ -163,8 +164,8 @@ void EmoteShortcutContainer::safeDraw(Graphics *restrict graphics) restrict2 if (sprite != nullptr) { sprite->draw(graphics, - (i % mGridWidth) * mBoxWidth + 2, - (i / mGridWidth) * mBoxHeight + 10); + (i % mGridWidth) * mBoxWidth + mImageOffsetX, + (i / mGridWidth) * mBoxHeight + mImageOffsetY); } } } @@ -181,7 +182,8 @@ void EmoteShortcutContainer::safeDraw(Graphics *restrict graphics) restrict2 mForegroundColor, mForegroundColor2, key, - emoteX + 2, emoteY + 2); + emoteX + mTextOffsetX, + emoteY + mTextOffsetY); } BLOCK_END("EmoteShortcutContainer::draw") diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 81ccf4ab5..6a2480bae 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -124,7 +124,8 @@ void ItemShortcutContainer::draw(Graphics *const graphics) mForegroundColor, mForegroundColor, key, - itemX + 2, itemY + 2); + itemX + mTextOffsetX, + itemY + mTextOffsetY); const int itemId = selShortcut->getItem(i); const ItemColor itemColor = selShortcut->getItemColor(i); @@ -149,7 +150,9 @@ void ItemShortcutContainer::draw(Graphics *const graphics) caption = "Eq."; image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); if (item->isEquipped() == Equipped_true) { font->drawString(graphics, @@ -184,7 +187,9 @@ void ItemShortcutContainer::draw(Graphics *const graphics) if (image != nullptr) { image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); } } @@ -192,7 +197,8 @@ void ItemShortcutContainer::draw(Graphics *const graphics) mForegroundColor, mForegroundColor, spell->getSymbol(), - itemX + 2, itemY + mBoxHeight / 2); + itemX + mTextOffsetX, + itemY + mBoxHeight / 2); } } else if (skillDialog != nullptr) @@ -206,7 +212,9 @@ void ItemShortcutContainer::draw(Graphics *const graphics) if (image != nullptr) { image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); } if (!skill->data->haveIcon) { @@ -214,7 +222,7 @@ void ItemShortcutContainer::draw(Graphics *const graphics) mForegroundColor, mForegroundColor, skill->data->shortName, - itemX + 2, + itemX + mTextOffsetX, itemY + mBoxHeight / 2); } } @@ -263,7 +271,8 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics) mForegroundColor, mForegroundColor, key, - itemX + 2, itemY + 2); + itemX + mTextOffsetX, + itemY + mTextOffsetY); const int itemId = selShortcut->getItem(i); const ItemColor itemColor = selShortcut->getItemColor(i); @@ -288,7 +297,9 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics) caption = "Eq."; image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); if (item->isEquipped() == Equipped_true) { font->drawString(graphics, @@ -323,7 +334,9 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics) if (image != nullptr) { image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); } } @@ -331,7 +344,8 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics) mForegroundColor, mForegroundColor, spell->getSymbol(), - itemX + 2, itemY + mBoxHeight / 2); + itemX + mTextOffsetX, + itemY + mBoxHeight / 2); } } else if (skillDialog != nullptr) @@ -345,7 +359,9 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics) if (image != nullptr) { image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); } if (!skill->data->haveIcon) { @@ -353,7 +369,7 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics) mForegroundColor, mForegroundColor, skill->data->shortName, - itemX + 2, + itemX + mTextOffsetX, itemY + mBoxHeight / 2); } } diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index f1e9c8a18..5eb4ea46f 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -25,6 +25,7 @@ #include "settings.h" #include "gui/gui.h" +#include "gui/skin.h" #include "utils/delete2.h" @@ -49,6 +50,10 @@ ShortcutContainer::ShortcutContainer(Widget2 *const widget) : mBoxHeight(1), mGridWidth(1), mGridHeight(1), + mImageOffsetX(2), + mImageOffsetY(2), + mTextOffsetX(2), + mTextOffsetY(2), mVertexes(new ImageCollection) { mAllowLogic = false; @@ -164,4 +169,11 @@ void ShortcutContainer::setSkin(const Widget2 *const widget, { setWidget2(widget); mSkin = skin; + if (mSkin) + { + mImageOffsetX = mSkin->getOption("imageOffsetX", 2); + mImageOffsetY = mSkin->getOption("imageOffsetY", 2); + mTextOffsetX = mSkin->getOption("textOffsetX", 2); + mTextOffsetY = mSkin->getOption("textOffsetY", 2); + } } diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index fd64827ea..55e41c714 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -119,6 +119,10 @@ class ShortcutContainer notfinal : public Widget, int mBoxHeight; int mGridWidth; int mGridHeight; + int mImageOffsetX; + int mImageOffsetY; + int mTextOffsetX; + int mTextOffsetY; ImageCollection *mVertexes; }; diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 4d53e8190..b2a80209e 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -109,7 +109,9 @@ void SpellShortcutContainer::draw(Graphics *const graphics) if (image != nullptr) { image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); } } @@ -117,7 +119,8 @@ void SpellShortcutContainer::draw(Graphics *const graphics) mForegroundColor, mForegroundColor2, spell->getSymbol(), - itemX + 2, itemY + mBoxHeight / 2); + itemX + mTextOffsetX, + itemY + mBoxHeight / 2); } } @@ -169,7 +172,9 @@ void SpellShortcutContainer::safeDraw(Graphics *const graphics) if (image != nullptr) { image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); } } @@ -177,7 +182,8 @@ void SpellShortcutContainer::safeDraw(Graphics *const graphics) mForegroundColor, mForegroundColor2, spell->getSymbol(), - itemX + 2, itemY + mBoxHeight / 2); + itemX + mTextOffsetX, + itemY + mBoxHeight / 2); } } diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp index cac320d54..e03d19872 100644 --- a/src/gui/widgets/virtshortcutcontainer.cpp +++ b/src/gui/widgets/virtshortcutcontainer.cpp @@ -123,7 +123,9 @@ void VirtShortcutContainer::draw(Graphics *const graphics) caption = "Eq."; image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); if (item->isEquipped() == Equipped_true) { font->drawString(graphics, @@ -197,7 +199,9 @@ void VirtShortcutContainer::safeDraw(Graphics *const graphics) caption = "Eq."; image->setAlpha(1.0F); - graphics->drawImage(image, itemX, itemY); + graphics->drawImage(image, + itemX + mImageOffsetX, + itemY + mImageOffsetY); if (item->isEquipped() == Equipped_true) { font->drawString(graphics, |