Files
OpenEngine/editor/include/panels/scene_hierarchy.hpp
2026-02-17 16:34:20 +01:00

42 lines
1.2 KiB
C++

#ifndef SCENE_HIERARCHY_HPP
#define SCENE_HIERARCHY_HPP
#include "imgui.h"
#include <array>
#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