metaforce/Runtime/CTimeProvider.cpp

27 lines
688 B
C++
Raw Normal View History

#include "Runtime/CTimeProvider.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
2015-10-27 20:04:02 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
static CTimeProvider* s_currentTimeProvider = nullptr;
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(s_currentTimeProvider) {
if (x8_lastProvider != nullptr) {
2018-12-08 05:30:43 +00:00
x8_lastProvider->x4_first = false;
}
2015-10-27 20:04:02 +00:00
s_currentTimeProvider = this;
2016-02-18 16:14:57 +00:00
2018-12-08 05:30:43 +00:00
CGraphics::SetExternalTimeProvider(this);
2015-10-27 20:04:02 +00:00
}
2018-12-08 05:30:43 +00:00
CTimeProvider::~CTimeProvider() {
s_currentTimeProvider = x8_lastProvider;
if (s_currentTimeProvider != nullptr) {
s_currentTimeProvider->x4_first = true;
}
CGraphics::SetExternalTimeProvider(s_currentTimeProvider);
2015-10-27 20:04:02 +00:00
}
2021-04-10 08:42:06 +00:00
} // namespace metaforce