Fixed #1680 (notification shown at wrong place after changing resolution).

This commit is contained in:
hiker 2014-11-10 16:32:35 +11:00
parent 5401e7f3b7
commit bfe7bff877
3 changed files with 13 additions and 1 deletions

View File

@ -42,6 +42,7 @@
#include "graphics/water.hpp"
#include "graphics/wind.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/message_queue.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
@ -863,7 +864,7 @@ void IrrDriver::applyResolutionSettings()
// No need to reload cached track data (track_manager->cleanAllCachedData
// above) - this happens dynamically when the tracks are loaded.
GUIEngine::reshowCurrentScreen();
MessageQueue::updatePosition();
} // applyResolutionSettings
// ----------------------------------------------------------------------------

View File

@ -121,6 +121,16 @@ void createLabel(const Message *message)
g_area = irr::core::recti(x, y, x+dim.Width, y+dim.Height);
} // createLabel
// ----------------------------------------------------------------------------
/** Called when the screen resolution is changed to compute the new
* position of the message. */
void updatePosition()
{
if (g_all_messages.size() == 0) return;
Message *last = g_all_messages.top();
createLabel(last);
} // updatePosition
// ----------------------------------------------------------------------------
/** Adds a message to the message queue.
* \param mt The MessageType of the message.

View File

@ -37,6 +37,7 @@ namespace MessageQueue
enum MessageType {MT_FRIEND, MT_ACHIEVEMENT};
void add(MessageType mt, const core::stringw &message);
void updatePosition();
void update(float dt);
}; // namespace GUIEngine