2015-10-27 20:04:02 +00:00
|
|
|
#include "CTimeProvider.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "Graphics/CGraphics.hpp"
|
2015-10-27 20:04:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-10-27 20:04:02 +00:00
|
|
|
{
|
2016-02-07 16:15:43 +00:00
|
|
|
CTimeProvider* CTimeProvider::g_currentTimeProvider = nullptr;
|
2015-10-27 20:04:02 +00:00
|
|
|
CTimeProvider::CTimeProvider(const float& time)
|
2016-02-07 16:15:43 +00:00
|
|
|
: x0_currentTime(time), x8_lastProvider(g_currentTimeProvider)
|
2015-10-27 20:04:02 +00:00
|
|
|
{
|
|
|
|
if (x8_lastProvider != nullptr)
|
|
|
|
x8_lastProvider->x4_first = false;
|
|
|
|
|
2016-02-18 16:14:57 +00:00
|
|
|
g_currentTimeProvider = this;
|
|
|
|
|
2015-10-27 20:04:02 +00:00
|
|
|
CGraphics::SetExternalTimeProvider(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
CTimeProvider::~CTimeProvider()
|
|
|
|
{
|
2016-02-07 16:15:43 +00:00
|
|
|
g_currentTimeProvider = x8_lastProvider;
|
|
|
|
if (g_currentTimeProvider)
|
|
|
|
g_currentTimeProvider->x4_first = true;
|
2016-03-31 06:18:56 +00:00
|
|
|
CGraphics::SetExternalTimeProvider(g_currentTimeProvider);
|
2015-10-27 20:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|