1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/includes/xna/game/time.hpp

27 lines
984 B
C++
Raw Normal View History

2024-03-21 16:01:47 -03:00
#ifndef XNA_GAME_TIME_HPP
#define XNA_GAME_TIME_HPP
2024-07-13 22:50:52 -03:00
#include "../default.hpp"
2024-03-23 17:23:07 -03:00
#include "../csharp/timespan.hpp"
2024-03-21 16:01:47 -03:00
namespace xna {
2024-08-02 11:31:54 -03:00
//Snapshot of the game timing state expressed in values that can be used by variable-step (real time) or fixed-step (game time) games.
2024-03-21 16:01:47 -03:00
class GameTime {
public:
constexpr GameTime() = default;
2024-03-23 17:23:07 -03:00
constexpr GameTime(const TimeSpan& elapsedGameTime, const TimeSpan& totalGameTime, bool isRunningSlowly) :
ElapsedGameTime(elapsedGameTime),
IsRunningSlowly(isRunningSlowly),
TotalGameTime(totalGameTime) { }
2024-03-21 16:01:47 -03:00
2024-08-02 11:31:54 -03:00
//The amount of elapsed game time since the last update.
2024-03-23 17:23:07 -03:00
TimeSpan ElapsedGameTime{ 0 };
2024-08-02 11:31:54 -03:00
//Gets a value indicating that the game loop is taking longer than its TargetElapsedTime. In this case, the game loop can be considered to be running too slowly and should do something to "catch up."
2024-03-23 17:23:07 -03:00
bool IsRunningSlowly{ false };
2024-08-02 11:31:54 -03:00
//The amount of game time since the start of the game.
2024-03-23 17:23:07 -03:00
TimeSpan TotalGameTime{ 0 };
2024-03-21 16:01:47 -03:00
};
}
#endif