From f9c1374417b17c45f84884e9ca0327910d187898 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 May 2018 02:00:05 +0300 Subject: Add skin options keyOffsetX and keyOffsetY for key offset. In item shortcut container. --- src/gui/widgets/itemshortcutcontainer.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/gui/widgets/itemshortcutcontainer.cpp') 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); -- cgit v1.2.3-60-g2f50