From c5d313d0e9e73fea6a4124125bf8001b3f5d7807 Mon Sep 17 00:00:00 2001 From: tristanklempka Date: Mon, 29 Jul 2024 15:40:25 +0200 Subject: [PATCH] Minor fixes before switching to raylib --- include/NodeSystem.h | 4 ---- include/RenderingSystem.h | 2 +- include/components/Shape.h | 3 ++- src/RenderingSystem.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/NodeSystem.h b/include/NodeSystem.h index 0aeb50c..6c1e43e 100644 --- a/include/NodeSystem.h +++ b/include/NodeSystem.h @@ -28,10 +28,6 @@ class NodeSystem : public System { private: QueryFunction m_query; - std::unordered_set m_rootNodes; - std::unordered_map m_nodeTransforms; - std::unordered_map m_parentMap; - std::unordered_map> m_childNodes; void onEventEntityChildAdded(Entity::Id parentId, Entity::Id childId) const; }; diff --git a/include/RenderingSystem.h b/include/RenderingSystem.h index 9712846..6c31417 100644 --- a/include/RenderingSystem.h +++ b/include/RenderingSystem.h @@ -14,7 +14,7 @@ #include "components/Node.h" // for Node #include "components/Shape.h" // for Shape class World; -namespace sf { class Drawable; } +namespace sf { class Shape; } namespace sf { class RenderWindow; } namespace sf { class Transform; } diff --git a/include/components/Shape.h b/include/components/Shape.h index 74c4fe0..f21aaaf 100644 --- a/include/components/Shape.h +++ b/include/components/Shape.h @@ -5,10 +5,11 @@ #ifndef DRAWABLE_H #define DRAWABLE_H +#include #include struct Shape { - std::unique_ptr shape; + std::unique_ptr shape{}; }; #endif //DRAWABLE_H diff --git a/src/RenderingSystem.cpp b/src/RenderingSystem.cpp index b36fe41..e57b74d 100644 --- a/src/RenderingSystem.cpp +++ b/src/RenderingSystem.cpp @@ -9,7 +9,6 @@ #include // for unique_ptr #include "ComponentManager.h" // for ComponentManager::getCompo... #include "World.h" // for World -#include "World.h" // for World::getComponentQuery RenderingSystem::RenderingSystem(World& world, sf::RenderWindow& window) : m_query(world.getComponentQuery()), m_window(window) {} @@ -23,7 +22,7 @@ void RenderingSystem::update() { } void RenderingSystem::doDraw(const Entity::Id id, const sf::Transform& parentTransform) { - m_query([this, parentTransform](Entity::Id, const Node& node, const Shape& renderable) { + m_query([this, parentTransform](Entity::Id, Node& node, Shape& renderable) { m_window.draw(*renderable.shape, node.transform * parentTransform); for (const auto child: node.children) { doDraw(child, node.transform * parentTransform);