From 3a23e41255af0de3c5c7f5d9df981c8b205e291f Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 13 Dec 2024 17:42:34 +0100 Subject: add timer functionality to script --- src/crepe/system/ScriptSystem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/crepe/system/ScriptSystem.cpp') diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp index d6b2ca1..4afd2ba 100644 --- a/src/crepe/system/ScriptSystem.cpp +++ b/src/crepe/system/ScriptSystem.cpp @@ -11,6 +11,7 @@ void ScriptSystem::update() { dbg_trace(); ComponentManager & mgr = this->mediator.component_manager; + LoopTimerManager & timer = this->mediator.loop_timer; RefVector behavior_scripts = mgr.get_components_by_type(); for (BehaviorScript & behavior_script : behavior_scripts) { @@ -23,6 +24,8 @@ void ScriptSystem::update() { script->init(); script->initialized = true; } - script->update(); + + duration_t delta_time = timer.get_delta_time(); + script->update(delta_time); } } -- cgit v1.2.3 From 40d64aa8f836087fd9a1af51e257533194bf2d80 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 18 Dec 2024 13:55:45 +0100 Subject: fix ScriptSystem delta time --- src/crepe/system/ScriptSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/crepe/system/ScriptSystem.cpp') diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp index 4afd2ba..0605c7a 100644 --- a/src/crepe/system/ScriptSystem.cpp +++ b/src/crepe/system/ScriptSystem.cpp @@ -25,7 +25,7 @@ void ScriptSystem::update() { script->initialized = true; } - duration_t delta_time = timer.get_delta_time(); + duration_t delta_time = timer.get_scaled_fixed_delta_time(); script->update(delta_time); } } -- cgit v1.2.3