From 7f32a1d51ba71eeb94ce63029d61156ae9ac76cc Mon Sep 17 00:00:00 2001 From: illyum Date: Wed, 11 Sep 2024 21:45:57 -0600 Subject: [PATCH] fix: scene manager rendering --- src/scene_manager.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/scene_manager.h b/src/scene_manager.h index b18c4d7..5e62982 100644 --- a/src/scene_manager.h +++ b/src/scene_manager.h @@ -26,14 +26,30 @@ public: void UpdateActiveScene() { if (activeScene != entt::null) { + // Iterate over entities in the active scene that have an InputComponent + auto view = registry.view(); + for (auto entity : view) { + auto& inputComponent = view.get(entity); + inputComponent.Update(); // This will call the input logic + } } } void RenderActiveScene() { if (activeScene != entt::null) { + // Iterate over entities in the active scene that have both SpriteComponent and TransformComponent + auto view = registry.view(); + for (auto entity : view) { + auto& sprite = view.get(entity); + auto& transform = view.get(entity); + + // Render the sprite at the position defined by the TransformComponent + sprite.Render(transform); + } } } + private: entt::registry& registry; entt::entity activeScene;