summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-05-23 02:00:05 +0300
committerAndrei Karas <akaras@inbox.ru>2018-05-23 02:00:05 +0300
commitf9c1374417b17c45f84884e9ca0327910d187898 (patch)
tree64003f4a8d4b088be58bbf6de299b47c585a76bb /src/gui/widgets
parent4150f81fd2bd2de6251f0bdf05361922c63713e5 (diff)
downloadmanaverse-f9c1374417b17c45f84884e9ca0327910d187898.tar.gz
manaverse-f9c1374417b17c45f84884e9ca0327910d187898.tar.bz2
manaverse-f9c1374417b17c45f84884e9ca0327910d187898.tar.xz
manaverse-f9c1374417b17c45f84884e9ca0327910d187898.zip
Add skin options keyOffsetX and keyOffsetY for key offset.
In item shortcut container.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp22
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h7
2 files changed, 19 insertions, 10 deletions
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 6a2480bae..50155fa92 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -30,6 +30,7 @@
#include "input/inputmanager.h"
+#include "gui/skin.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
@@ -56,13 +57,15 @@
ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget,
const unsigned number) :
ShortcutContainer(widget),
- mItemClicked(false),
- mNumber(number),
mEquipedColor(getThemeColor(ThemeColorId::ITEM_EQUIPPED, 255U)),
mEquipedColor2(getThemeColor(ThemeColorId::ITEM_EQUIPPED_OUTLINE, 255U)),
mUnEquipedColor(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED, 255U)),
mUnEquipedColor2(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED_OUTLINE,
- 255U))
+ 255U)),
+ mNumber(number),
+ mKeyOffsetX(2),
+ mKeyOffsetY(2),
+ mItemClicked(false)
{
mMaxItems = ItemShortcut::getItemCount();
}
@@ -82,6 +85,11 @@ void ItemShortcutContainer::setSkin(const Widget2 *const widget,
255U);
mForegroundColor = getThemeColor(ThemeColorId::TEXT, 255U);
mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE, 255U);
+ if (mSkin != nullptr)
+ {
+ mKeyOffsetX = mSkin->getOption("keyOffsetX", 2);
+ mKeyOffsetY = mSkin->getOption("keyOffsetY", 2);
+ }
}
void ItemShortcutContainer::draw(Graphics *const graphics)
@@ -124,8 +132,8 @@ void ItemShortcutContainer::draw(Graphics *const graphics)
mForegroundColor,
mForegroundColor,
key,
- itemX + mTextOffsetX,
- itemY + mTextOffsetY);
+ itemX + mKeyOffsetX,
+ itemY + mKeyOffsetY);
const int itemId = selShortcut->getItem(i);
const ItemColor itemColor = selShortcut->getItemColor(i);
@@ -271,8 +279,8 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics)
mForegroundColor,
mForegroundColor,
key,
- itemX + mTextOffsetX,
- itemY + mTextOffsetY);
+ itemX + mKeyOffsetX,
+ itemY + mKeyOffsetY);
const int itemId = selShortcut->getItem(i);
const ItemColor itemColor = selShortcut->getItemColor(i);
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index 73f599add..ee1242b80 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -78,13 +78,14 @@ class ItemShortcutContainer final : public ShortcutContainer
Skin *const skin) override final;
private:
- bool mItemClicked;
- unsigned mNumber;
-
Color mEquipedColor;
Color mEquipedColor2;
Color mUnEquipedColor;
Color mUnEquipedColor2;
+ unsigned mNumber;
+ int mKeyOffsetX;
+ int mKeyOffsetY;
+ bool mItemClicked;
};
#endif // GUI_WIDGETS_ITEMSHORTCUTCONTAINER_H