Implement CTimeProvider

This commit is contained in:
Phillip Stephens 2015-10-27 13:04:02 -07:00
parent 8ffa2d2b15
commit 7dedea85ff
2 changed files with 51 additions and 0 deletions

32
Runtime/CTimeProvider.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "CTimeProvider.hpp"
#if 0
#include "CGraphics.hpp"
#endif
namespace Retro
{
CTimeProvider* g_TimeProvider = nullptr;
CTimeProvider::CTimeProvider(const float& time)
: x0_currentTime(time)
{
x8_lastProvider = g_TimeProvider;
if (x8_lastProvider != nullptr)
x8_lastProvider->x4_first = false;
#if 0
CGraphics::SetExternalTimeProvider(this);
#endif
}
CTimeProvider::~CTimeProvider()
{
g_TimeProvider = x8_lastProvider;
if (g_TimeProvider)
g_TimeProvider->x4_first = true;
#if 0
CGraphics::SetExternalTimeProvider(g_TimeProvider);
#endif
}
}

19
Runtime/CTimeProvider.hpp Normal file
View File

@ -0,0 +1,19 @@
#ifndef __RETRO__CTIMEPROVIDER_HPP__
#define __RETRO__CTIMEPROVIDER_HPP__
namespace Retro
{
class CTimeProvider;
extern CTimeProvider* g_TimeProvider;
class CTimeProvider
{
public:
const float& x0_currentTime; // in seconds
bool x4_first = true;
CTimeProvider* x8_lastProvider = nullptr;
CTimeProvider(const float& time);
~CTimeProvider();
};
}
#endif