diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-14 11:32:59 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-14 11:32:59 +0100 |
commit | a61e3d522c29cfea966a06bb9f9e5e42eae2b7ab (patch) | |
tree | 7c0e7d5a0d61f8fa70442eb0584dd012225b5f44 /src/crepe/api | |
parent | 6ddb8c0e7003a66a7b350f7a11ef80803c180307 (diff) | |
parent | b6e835c5f9da24b78a005c6c8896ad35ac965234 (diff) |
merge `loek/scripts`
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/Script.cpp | 3 | ||||
-rw-r--r-- | src/crepe/api/Script.h | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp index 34e7908..cafc636 100644 --- a/src/crepe/api/Script.cpp +++ b/src/crepe/api/Script.cpp @@ -45,3 +45,6 @@ void Script::replay::release(recording_t recording) { ReplayManager & mgr = this->mediator->replay_manager; return mgr.release(recording); } + +LoopTimerManager & Script::get_loop_timer() const { return this->mediator->loop_timer; } + diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h index 6536fa4..b052f8b 100644 --- a/src/crepe/api/Script.h +++ b/src/crepe/api/Script.h @@ -3,6 +3,7 @@ #include <vector> #include "../manager/EventManager.h" +#include "../manager/LoopTimerManager.h" #include "../manager/Mediator.h" #include "../manager/ReplayManager.h" #include "../system/CollisionSystem.h" @@ -48,9 +49,17 @@ protected: /** * \brief Script update function (empty by default) * + * \param delta_time Time since last fixed update + * * This function is called during the ScriptSystem::update() routine if the \c BehaviorScript * component holding this script instance is active. */ + virtual void update(duration_t delta_time) { return this->update(); } + /** + * \brief Fallback script update function (empty by default) + * + * Allows the game programmer to ignore parameters passed to \c update() + */ virtual void update() {} //! \} @@ -157,7 +166,9 @@ protected: replay(OptionalRef<Mediator> & mediator) : mediator(mediator) {} friend class Script; } replay{mediator}; - //! \} + + //! Retrieve LoopTimerManager reference + LoopTimerManager & get_loop_timer() const; private: /** |