diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-16 01:20:24 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-16 01:20:24 +0000 |
commit | be1af40e371845bcad1337cc59e5f5ac0f991f02 (patch) | |
tree | b69af163b0bd59c8a30ebb94629df9091caec242 /src | |
parent | 11e74c7299895136b366c2ea344a7ae98b374b96 (diff) | |
download | mana-be1af40e371845bcad1337cc59e5f5ac0f991f02.tar.gz mana-be1af40e371845bcad1337cc59e5f5ac0f991f02.tar.bz2 mana-be1af40e371845bcad1337cc59e5f5ac0f991f02.tar.xz mana-be1af40e371845bcad1337cc59e5f5ac0f991f02.zip |
Fixed a width that I accidently messed up earlier, as well as made text
and speech bubble transitions smoother.
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 30 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 2 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp index 4958700f..f05652f3 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -164,16 +164,6 @@ void Being::setSpeech(const std::string &text, Uint32 time) { mSpeech = text; - if (!config.getValue("speechbubble", 1)) - { - // don't introduce a memory leak - delete mText; - - mText = new Text(text, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET, - gcn::Graphics::CENTER, speechFont, - gcn::Color(255, 255, 255)); - } - mSpeechTime = 500; } @@ -468,6 +458,12 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY) // Draw speech above this being if (mSpeechTime > 0 && config.getValue("speechbubble", 1)) { + if (mText) + { + delete mText; + mText = 0; + } + mSpeechBubble->setCaption(mName); mSpeechBubble->setWindowName(mName); // Not quite centered, but close enough. However, it's not too important to get @@ -477,6 +473,20 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY) (mSpeechBubble->getNumRows()*14)); mSpeechBubble->setVisible(true); } + else if (!config.getValue("speechbubble", 1)) + { + mSpeechBubble->setVisible(false); + // don't introduce a memory leak + if (mText) + { + delete mText; + mText = 0; + } + + mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET, + gcn::Graphics::CENTER, speechFont, + gcn::Color(255, 255, 255)); + } else if (mSpeechTime == 0) { mSpeechBubble->setVisible(false); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 6a246501..879a3066 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -151,7 +151,7 @@ Setup_Video::Setup_Video(): mParticleEffectsCheckBox->setPosition(175, 30); mCustomCursorCheckBox->setPosition(110, 50); mSpeechBubbleCheckBox->setPosition(110, 70); - mAlphaSlider->setDimension(gcn::Rectangle(10, 100, 100, 10)); + mAlphaSlider->setDimension(gcn::Rectangle(10, 100, 75, 10)); alphaLabel->setPosition(20 + mAlphaSlider->getWidth(), mAlphaSlider->getY()); mFpsCheckBox->setPosition(90, 120); |