ECS with entt

This commit is contained in:
Erris
2026-02-17 00:50:43 +01:00
parent 86392e0790
commit d4c420d5b4
30 changed files with 1314 additions and 222 deletions

View File

@@ -0,0 +1,40 @@
#ifndef SCENE_HIERARCHY_HPP
#define SCENE_HIERARCHY_HPP
#include "imgui.h"
#include <open_engine.hpp>
namespace OpenEngine {
class SceneHierarchy
{
public:
SceneHierarchy() = default;
SceneHierarchy(const Ref<Scene>& scene);
void SetContext(const Ref<Scene>& scene);
void OnImGuiRender();
private:
void DrawEntityNode(Entity& entity);
void DrawComponents(Entity& entity);
template <typename T>
void DrawComponentDrawer(Entity& entity, const char* header)
{
if (entity.HasComponent<T>())
if (ImGui::TreeNodeEx((void*)typeid(T).hash_code(), ImGuiTreeNodeFlags_DefaultOpen, "%s", header)) {
entity.GetComponents<T>().OnImGuiRender(entity);
ImGui::TreePop();
ImGui::Separator();
}
}
private:
Ref<Scene> scene;
Entity selected_context, renamed_entity;
double last_selected_time = 10.0;
};
}
#endif // SCENE_HIERARCHY_HPP