diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-01 03:34:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-01 03:34:08 +0300 |
commit | 5adcad73b15aafa56ef77c794bf7ebfeff28049b (patch) | |
tree | 2cfe32eade47b7a84375cc7a3c60085b147183fe /src | |
parent | f5ed6062017598fbdf9c3a7e4c53b5eeeddfe3ad (diff) | |
download | manaverse-5adcad73b15aafa56ef77c794bf7ebfeff28049b.tar.gz manaverse-5adcad73b15aafa56ef77c794bf7ebfeff28049b.tar.bz2 manaverse-5adcad73b15aafa56ef77c794bf7ebfeff28049b.tar.xz manaverse-5adcad73b15aafa56ef77c794bf7ebfeff28049b.zip |
Improve emotes window draw speed.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 32 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index a7bb46433..9e1206a4c 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -117,6 +117,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) } } + graphics->setColor(mForegroundColor); for (unsigned i = 0; i < mMaxItems; i++) { const int emoteX = (i % mGridWidth) * mBoxWidth; @@ -126,7 +127,6 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) const std::string key = inputManager.getKeyValueString( Input::KEY_EMOTE_1 + i); - graphics->setColor(mForegroundColor); g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT); } const unsigned sz = static_cast<unsigned>(mEmoteImg.size()); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 854d055d2..4ccfb566f 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -263,6 +263,27 @@ void ItemContainer::draw(gcn::Graphics *graphics) image->setAlpha(1.0f); // ensure the image if fully drawn... g->drawImage(image, itemX, itemY); } + } + } + + for (int j = 0; j < mGridRows; j++) + { + const int intY0 = j * BOX_HEIGHT; + int itemIndex = j * mGridColumns - 1; + for (int i = 0; i < mGridColumns; i++) + { + int itemX = i * BOX_WIDTH; + int itemY = intY0; + itemIndex ++; + if (mShowMatrix[itemIndex] < 0) + continue; + + const Item *const item = mInventory->getItem( + mShowMatrix[itemIndex]); + + if (!item || item->getId() == 0) + continue; + // Draw item caption std::string caption; if (item->getQuantity() > 1 || mForceQuantity) @@ -279,17 +300,6 @@ void ItemContainer::draw(gcn::Graphics *graphics) itemY + BOX_HEIGHT - 14, gcn::Graphics::CENTER); } } - -/* - // Draw an orange box around the selected item - if (isFocused() && mHighlightedIndex != -1 && mGridColumns) - { - const int itemX = (mHighlightedIndex % mGridColumns) * BOX_WIDTH; - const int itemY = (mHighlightedIndex / mGridColumns) * BOX_HEIGHT; - g->setColor(gcn::Color(255, 128, 0)); - g->drawRectangle(gcn::Rectangle(itemX, itemY, BOX_WIDTH, BOX_HEIGHT)); - } -*/ } void ItemContainer::selectNone() |