From c1a7b7545a9f8ad3f22d36eaeb3e59221457766c Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 11 Dec 2024 21:07:38 +0300 Subject: [PATCH] change components on_render call timing --- src/frontend/screens/LevelScreen.cpp | 4 ++++ src/objects/Entities.cpp | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/screens/LevelScreen.cpp b/src/frontend/screens/LevelScreen.cpp index 34d1db678..4436cf488 100644 --- a/src/frontend/screens/LevelScreen.cpp +++ b/src/frontend/screens/LevelScreen.cpp @@ -18,6 +18,7 @@ #include "graphics/ui/elements/Menu.hpp" #include "graphics/ui/GUI.hpp" #include "logic/LevelController.hpp" +#include "logic/scripting/scripting.hpp" #include "logic/scripting/scripting_hud.hpp" #include "util/stringutil.hpp" #include "physics/Hitbox.hpp" @@ -182,6 +183,9 @@ void LevelScreen::draw(float delta) { Viewport viewport(Window::width, Window::height); DrawContext ctx(nullptr, viewport, batch.get()); + if (!hud->isPause()) { + scripting::on_entities_render(engine->getTime().getDelta()); + } worldRenderer->draw( ctx, *camera, hudVisible, hud->isPause(), delta, postProcessing.get() ); diff --git a/src/objects/Entities.cpp b/src/objects/Entities.cpp index 614adf417..79c0ba668 100644 --- a/src/objects/Entities.cpp +++ b/src/objects/Entities.cpp @@ -556,10 +556,6 @@ void Entities::render( float delta, bool pause ) { - if (!pause) { - scripting::on_entities_render(delta); - } - auto view = registry.view(); for (auto [entity, transform, skeleton] : view.each()) { if (transform.dirty) {