MessageBoxmangerTimer is now working properly

actorid
Sebastian Wick 14 years ago
parent a4217f8fb8
commit 4d1db13c8f

@ -11,14 +11,13 @@ MessageBoxManager::MessageBoxManager (WindowManager *windowManager)
void MessageBoxManager::onFrame (float frameDuration)
{
std::vector<MessageBoxManagerTimer*>::const_iterator it;
std::vector<MessageBoxManagerTimer>::iterator it;
for(it = mTimers.begin(); it != mTimers.end(); it++)
{
(*it)->current += frameDuration;
if((*it)->current >= (*it)->max)
it->current += frameDuration;
if(it->current >= it->max)
{
// FIXME: delete the messagebox and erase it from the vector
std::cout << "delete MessageBox" << std::endl;
}
}
}
@ -67,10 +66,10 @@ void MessageBoxManager::createInteractiveMessageBox (const std::string& message,
void MessageBoxManager::removeMessageBox (float time, MessageBox *msgbox)
{
MessageBoxManagerTimer *timer;
timer->current = 0;
timer->max = time;
timer->messageBox = msgbox;
MessageBoxManagerTimer timer;
timer.current = 0;
timer.max = time;
timer.messageBox = msgbox;
mTimers.insert(mTimers.end(), timer);
}

@ -3,7 +3,6 @@
#include <openengine/gui/layout.hpp>
#include <MyGUI.h>
#include <OgreTimer.h>
#include "window_base.hpp"
#include "window_manager.hpp"
@ -36,7 +35,7 @@ namespace MWGui
private:
std::vector<MessageBox*> mMessageBoxes;
std::vector<MessageBoxManagerTimer*> mTimers;
std::vector<MessageBoxManagerTimer> mTimers;
float mMessageBoxSpeed;
};

Loading…
Cancel
Save