Changed selected type
Moving away from using the pure ENTT library types and starting to use my own
This commit is contained in:
@ -3,11 +3,14 @@
|
||||
|
||||
void Inspector::Draw()
|
||||
{
|
||||
|
||||
}
|
||||
if (selected.isValid()) {
|
||||
AddComponentDropDown();
|
||||
ShowComponents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Inspector::AddComponentDropDown(YoggieEngine::Entity& selected)
|
||||
void Inspector::AddComponentDropDown()
|
||||
{
|
||||
static char* names[] = { "Script Component", "Camera Component", "Light Component" };
|
||||
if (ImGui::Button("Add Component"))
|
||||
@ -28,7 +31,7 @@ void Inspector::AddComponentDropDown(YoggieEngine::Entity& selected)
|
||||
}
|
||||
|
||||
|
||||
void Inspector::ShowComponents(YoggieEngine::Entity& selected)
|
||||
void Inspector::ShowComponents()
|
||||
{
|
||||
auto component = selected.GetComponent<YoggieEngine::IdentifierComponent>();
|
||||
ImGui::InputText("Name:", (char*)component.name.c_str(), component.name.size() * sizeof(char), ImGuiInputTextFlags_ReadOnly);
|
||||
|
@ -8,13 +8,15 @@ inline void ComponentView(const std::string& componentName, voidFunction func);
|
||||
|
||||
class Inspector : public EditorWindow {
|
||||
public:
|
||||
Inspector() : EditorWindow("Inspector") {}
|
||||
Inspector( YoggieEngine::Entity& selected ) : EditorWindow("Inspector"), selected(selected){}
|
||||
|
||||
void Draw()override;
|
||||
|
||||
private:
|
||||
|
||||
void AddComponentDropDown(YoggieEngine::Entity& selected);
|
||||
void AddComponentDropDown();
|
||||
void ShowComponents();
|
||||
|
||||
void ShowComponents(YoggieEngine::Entity& selected);
|
||||
|
||||
YoggieEngine::Entity& selected;
|
||||
};
|
||||
|
@ -6,8 +6,8 @@ void SceneExplorer::Draw()
|
||||
YoggieEngine::Entity entity = YoggieEngine::Entity(enttNumber, &scene);
|
||||
auto id = entity.GetComponent<YoggieEngine::IdentifierComponent>();
|
||||
|
||||
if (ImGui::Selectable(id.name.c_str(), enttNumber == selected)) {
|
||||
selected = enttNumber;
|
||||
if (ImGui::Selectable(id.name.c_str(), entity == selected)) {
|
||||
selected = YoggieEngine::Entity(enttNumber, &scene);
|
||||
}
|
||||
});
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
|
||||
class SceneExplorer : public EditorWindow {
|
||||
public:
|
||||
SceneExplorer(entt::entity& selected, YoggieEngine::Scene& scene)
|
||||
SceneExplorer(YoggieEngine::Entity& selected, YoggieEngine::Scene& scene)
|
||||
: EditorWindow("SceneExplorer"), scene(scene), selected(selected)
|
||||
{}
|
||||
|
||||
@ -13,7 +13,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
entt::entity selected;
|
||||
YoggieEngine::Entity& selected;
|
||||
YoggieEngine::Scene& scene;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user