From 45f1f18c78e73280a8a861df2db6237bae6f6d80 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 12 Dec 2024 19:02:40 +0100 Subject: add script api for replaymanager --- src/example/replay.cpp | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'src/example/replay.cpp') diff --git a/src/example/replay.cpp b/src/example/replay.cpp index e7f4e6d..4c606d7 100644 --- a/src/example/replay.cpp +++ b/src/example/replay.cpp @@ -1,19 +1,6 @@ -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include +#include using namespace crepe; using namespace std; @@ -34,27 +21,20 @@ class AnimationScript : public Script { class Timeline : public Script { unsigned i = 0; - ReplayManager & mgr; recording_t recording; -public: - Timeline(ReplayManager & mgr) - : mgr(mgr) {} - void update() { switch (i++) { default: break; case 10: - mgr.record_start(); + replay.record_start(); break; case 60: - this->recording = mgr.record_end(); - break; - case 70: - mgr.play(this->recording); + this->recording = replay.record_end(); + replay.play(this->recording); break; - case 71: - mgr.release(this->recording); + case 61: + replay.release(this->recording); break; case 72: throw; @@ -86,7 +66,7 @@ public: square.add_component().set_script(); GameObject scapegoat = mgr.new_object(""); - scapegoat.add_component().set_script(mediator.replay_manager); + scapegoat.add_component().set_script(); } string get_name() const { return "scene1"; } @@ -100,5 +80,6 @@ int main(int argc, char * argv[]) { engine.add_scene(); engine.start(); + return 0; } -- cgit v1.2.3