载入中...
搜索中...
未找到
AnimationTime.h
浏览该文件的文档.
18 eve::DiagnosticCode::InvalidArgument, std::string(owner) + " simulation delta must be non-negative"));
22 eve::DiagnosticCode::Conflict, std::string(owner) + " simulation tick must advance monotonically"));
28 eve::DiagnosticCode::InvalidArgument, std::string(owner) + " simulation delta is outside float range"));
34inline eve::Result<eve::SimulationStep> legacyStep(float seconds, bool hasLastTick, eve::SimulationTick lastTick,
38 auto nextTick = hasLastTick ? lastTick.incremented() : std::optional<eve::SimulationTick>(eve::SimulationTick(1));
44 return eve::Result<eve::SimulationStep>::success(eve::SimulationStep{*nextTick, std::move(duration).takeValue()});
Common time values and an injectable deterministic simulation clock.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result< Duration > fromSeconds(double seconds)
Convert finite seconds to the nearest nanosecond.
Definition Time.cpp:16
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
constexpr std::optional< StrongUint64 > incremented() const noexcept
Returns the next value, or empty instead of unsigned wraparound.
Definition StrongUint64.h:30
Definition AnimationTime.h:10
eve::Result< eve::SimulationStep > legacyStep(float seconds, bool hasLastTick, eve::SimulationTick lastTick, const char *owner)
Convert a legacy seconds call to the next local scheduler step.
Definition AnimationTime.h:34
eve::Result< float > secondsForStep(const eve::SimulationStep &step, bool hasLastTick, eve::SimulationTick lastTick, const char *owner)
Validate a scheduler step before an animation object mutates state.
Definition AnimationTime.h:13
@ InvalidArgument
@ InvariantViolation
@ Conflict