diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-12 18:46:34 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-12 18:46:34 +0100 |
commit | f34daa492c30a0d28b747817a9f2d6fb0186cf80 (patch) | |
tree | 2c2501968f12e379ac196abb4161527d86a351e5 /src/crepe/manager/ReplayManager.cpp | |
parent | b9694e8cc6b85a0089f97ff3c21862adc75a7ee5 (diff) |
clean up ReplayManager API
Diffstat (limited to 'src/crepe/manager/ReplayManager.cpp')
-rw-r--r-- | src/crepe/manager/ReplayManager.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/crepe/manager/ReplayManager.cpp b/src/crepe/manager/ReplayManager.cpp index 81ff114..ab8a5a0 100644 --- a/src/crepe/manager/ReplayManager.cpp +++ b/src/crepe/manager/ReplayManager.cpp @@ -37,3 +37,31 @@ void ReplayManager::release(recording_t handle) { this->memory.erase(handle); } +void ReplayManager::frame_record() { + ComponentManager & components = this->mediator.component_manager; + Recording & recording = this->recording; + + recording.frames.push_back(components.save()); + recording.frame++; +} + +bool ReplayManager::frame_step() { + ComponentManager & components = this->mediator.component_manager; + Recording & recording = this->recording; + + ComponentManager::Snapshot & frame = recording.frames.at(recording.frame); + + components.restore(frame); + recording.frame++; + + if (recording.frame < recording.frames.size()) return false; + // end of recording + recording.frame = 0; + this->state = IDLE; + return true; +} + +ReplayManager::State ReplayManager::get_state() const { + return this->state; +} + |