mirror of https://github.com/AxioDL/metaforce.git
CTimeProvider: Move global instance to cpp file
This isn't used anywhere externally, so we can keep it hidden in the cpp file.
This commit is contained in:
parent
002102c530
commit
deff9d054b
|
@ -3,21 +3,24 @@
|
||||||
#include "Runtime/Graphics/CGraphics.hpp"
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
CTimeProvider* CTimeProvider::g_currentTimeProvider = nullptr;
|
static CTimeProvider* s_currentTimeProvider = nullptr;
|
||||||
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(g_currentTimeProvider) {
|
|
||||||
if (x8_lastProvider != nullptr)
|
|
||||||
x8_lastProvider->x4_first = false;
|
|
||||||
|
|
||||||
g_currentTimeProvider = this;
|
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(s_currentTimeProvider) {
|
||||||
|
if (x8_lastProvider != nullptr) {
|
||||||
|
x8_lastProvider->x4_first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_currentTimeProvider = this;
|
||||||
|
|
||||||
CGraphics::SetExternalTimeProvider(this);
|
CGraphics::SetExternalTimeProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTimeProvider::~CTimeProvider() {
|
CTimeProvider::~CTimeProvider() {
|
||||||
g_currentTimeProvider = x8_lastProvider;
|
s_currentTimeProvider = x8_lastProvider;
|
||||||
if (g_currentTimeProvider)
|
if (s_currentTimeProvider != nullptr) {
|
||||||
g_currentTimeProvider->x4_first = true;
|
s_currentTimeProvider->x4_first = true;
|
||||||
CGraphics::SetExternalTimeProvider(g_currentTimeProvider);
|
}
|
||||||
|
CGraphics::SetExternalTimeProvider(s_currentTimeProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
namespace urde {
|
namespace urde {
|
||||||
class CTimeProvider;
|
|
||||||
class CTimeProvider {
|
class CTimeProvider {
|
||||||
public:
|
public:
|
||||||
static CTimeProvider* g_currentTimeProvider;
|
|
||||||
const float& x0_currentTime; // in seconds
|
const float& x0_currentTime; // in seconds
|
||||||
bool x4_first = true;
|
bool x4_first = true;
|
||||||
CTimeProvider* x8_lastProvider = nullptr;
|
CTimeProvider* x8_lastProvider = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue