aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-11 18:51:58 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-11 18:51:58 +0100
commit313da47b72aafa0b40ac2cd2b586d525ed17fbd4 (patch)
tree428ec8c384b2ec8039013cbb540378a292bce128 /src
parenta2b67f879e2073c5b094c9a480bf637c98703001 (diff)
more WIP
Diffstat (limited to 'src')
-rw-r--r--src/crepe/manager/ReplayManager.cpp17
-rw-r--r--src/example/replay.cpp8
2 files changed, 17 insertions, 8 deletions
diff --git a/src/crepe/manager/ReplayManager.cpp b/src/crepe/manager/ReplayManager.cpp
index 40d34a4..82c2275 100644
--- a/src/crepe/manager/ReplayManager.cpp
+++ b/src/crepe/manager/ReplayManager.cpp
@@ -1,25 +1,36 @@
+#include "../util/Log.h"
+
#include "ReplayManager.h"
-#include "manager/Manager.h"
+#include "Manager.h"
using namespace crepe;
+using namespace std;
ReplayManager::ReplayManager(Mediator & mediator) : Manager(mediator) {
mediator.replay_manager = *this;
}
void ReplayManager::record_start() {
-
+ if (this->recording) this->release(this->current_recording);
+ this->current_recording++;
+ this->recording = true;
}
recording_t ReplayManager::record_end() {
- return 0;
+ this->recording = false;
+ return this->current_recording;
}
void ReplayManager::play(recording_t handle) {
+ if (!this->memory.contains(handle))
+ throw out_of_range(format("ReplayManager: no recording for handle {}", handle));
+ Recording & recording = *this->memory.at(handle);
+ dbg_log("TODO: magic");
}
void ReplayManager::release(recording_t handle) {
+ dbg_log("release");
}
diff --git a/src/example/replay.cpp b/src/example/replay.cpp
index 67acbd8..2f9c63e 100644
--- a/src/example/replay.cpp
+++ b/src/example/replay.cpp
@@ -2,6 +2,7 @@
#include <crepe/api/BoxCollider.h>
#include <crepe/api/Camera.h>
#include <crepe/api/Color.h>
+#include <crepe/api/Config.h>
#include <crepe/api/Event.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/LoopManager.h>
@@ -45,22 +46,17 @@ public:
default: break;
case 10:
mgr.record_start();
- Log::logf("start");
break;
case 60:
this->recording = mgr.record_end();
- Log::logf("stop");
break;
case 70:
mgr.play(this->recording);
- Log::logf("play");
break;
case 71:
mgr.release(this->recording);
- Log::logf("end");
break;
case 72:
- Log::logf("exit");
throw;
break;
};
@@ -97,6 +93,8 @@ public:
};
int main(int argc, char * argv[]) {
+ Config & cfg = Config::get_instance();
+ cfg.log.level = Log::Level::DEBUG;
LoopManager gameloop;
gameloop.add_scene<TestScene>();