// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Core/Config/Settings.h" #include "Engine/Serialization/Serialization.h" /// /// Time and game simulation settings container. /// /// class TimeSettings : public Settings { public: /// /// The target amount of the game logic updates per second (script updates frequency). /// float UpdateFPS = 30.0f; /// /// The target amount of the physics simulation updates per second (also fixed updates frequency). /// float PhysicsFPS = 60.0f; /// /// The target amount of the frames rendered per second (actual game FPS). /// float DrawFPS = 60.0f; /// /// The game time scale factor. Default is 1. /// float TimeScale = 1.0f; /// /// The maximum allowed delta time (in seconds) for the game logic update step. /// float MaxUpdateDeltaTime = (1.0f / 10.0f); public: // [Settings] void Apply() override; void RestoreDefault() override { UpdateFPS = 30.0f; PhysicsFPS = 60.0f; DrawFPS = 60.0f; TimeScale = 1.0f; MaxUpdateDeltaTime = 1.0f / 10.0f; } void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) final override { DESERIALIZE(UpdateFPS); DESERIALIZE(PhysicsFPS); DESERIALIZE(DrawFPS); DESERIALIZE(TimeScale); DESERIALIZE(MaxUpdateDeltaTime); } };