summaryrefslogtreecommitdiff
path: root/src/gui/emoteshortcutcontainer.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-05 23:13:55 -0700
committerIra Rice <irarice@gmail.com>2009-03-05 23:13:55 -0700
commitaa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5 (patch)
tree19c5a75a766b7df51ae468fb6b8fdbcfd2c6cc72 /src/gui/emoteshortcutcontainer.cpp
parent93e45964f3b7a0735984616f622ec32b40a21781 (diff)
downloadmana-client-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.gz
mana-client-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.bz2
mana-client-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.xz
mana-client-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.zip
Made some optimizations based on some profiling done by Octalot, as well
as some other optimizations that I could see that cut down on some unneeded redraws, which in turn improved frame rates slightly. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/emoteshortcutcontainer.cpp')
-rw-r--r--src/gui/emoteshortcutcontainer.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp
index e828df8b..f4cef106 100644
--- a/src/gui/emoteshortcutcontainer.cpp
+++ b/src/gui/emoteshortcutcontainer.cpp
@@ -76,6 +76,15 @@ EmoteShortcutContainer::~EmoteShortcutContainer()
void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
{
+ if (!isVisible())
+ return;
+
+ if (config.getValue("guialpha", 0.8) != mAlpha)
+ {
+ mAlpha = config.getValue("guialpha", 0.8);
+ mBackgroundImg->setAlpha(mAlpha);
+ }
+
Graphics *g = static_cast<Graphics*>(graphics);
graphics->setFont(getFont());
@@ -95,7 +104,8 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
if (emoteShortcut->getEmote(i))
{
- mEmoteImg[emoteShortcut->getEmote(i) - 1]->draw(g, emoteX + 2, emoteY + 10);
+ mEmoteImg[emoteShortcut->getEmote(i) - 1]->draw(g, emoteX + 2,
+ emoteY + 10);
}
}
@@ -112,12 +122,6 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
sprite->draw(g, tPosX, tPosY);
}
}
-
- if (config.getValue("guialpha", 0.8) != mAlpha)
- {
- mAlpha = config.getValue("guialpha", 0.8);
- mBackgroundImg->setAlpha(mAlpha);
- }
}
void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event)
@@ -130,9 +134,7 @@ void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event)
const int emoteId = emoteShortcut->getEmote(index);
if (index == -1)
- {
return;
- }
if (emoteId)
{
@@ -153,19 +155,17 @@ void EmoteShortcutContainer::mousePressed(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
- {
- return;
- }
+ return;
// Stores the selected emote if there is one.
if (emoteShortcut->isEmoteSelected())
{
- emoteShortcut->setEmote(index);
- emoteShortcut->setEmoteSelected(0);
+ emoteShortcut->setEmote(index);
+ emoteShortcut->setEmoteSelected(0);
}
else if (emoteShortcut->getEmote(index))
{
- mEmoteClicked = true;
+ mEmoteClicked = true;
}
}
@@ -176,9 +176,7 @@ void EmoteShortcutContainer::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (emoteShortcut->isEmoteSelected())
- {
emoteShortcut->setEmoteSelected(0);
- }
if (index == -1)
{
@@ -197,9 +195,7 @@ void EmoteShortcutContainer::mouseReleased(gcn::MouseEvent &event)
}
if (mEmoteClicked)
- {
mEmoteClicked = false;
- }
}
}