Add Engine::UpdateCount to sync gameplay logic updates with game loop rather than draw frames
This commit is contained in:
@@ -60,6 +60,7 @@ namespace EngineImpl
|
||||
|
||||
DateTime Engine::StartupTime;
|
||||
bool Engine::HasFocus = false;
|
||||
uint64 Engine::UpdateCount = 0;
|
||||
uint64 Engine::FrameCount = 0;
|
||||
Action Engine::FixedUpdate;
|
||||
Action Engine::Update;
|
||||
@@ -296,6 +297,8 @@ void Engine::OnUpdate()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Update");
|
||||
|
||||
UpdateCount++;
|
||||
|
||||
// Update application (will gather data and other platform related events)
|
||||
{
|
||||
PROFILE_CPU_NAMED("Platform.Tick");
|
||||
|
||||
@@ -28,7 +28,12 @@ public:
|
||||
API_FIELD(ReadOnly) static bool HasFocus;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current frame count since the start of the game.
|
||||
/// Gets the current update counter since the start of the game.
|
||||
/// </summary>
|
||||
API_FIELD(ReadOnly) static uint64 UpdateCount;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current frame (drawing) count since the start of the game.
|
||||
/// </summary>
|
||||
API_FIELD(ReadOnly) static uint64 FrameCount;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user