Relation widget + small memory leak solved
This commit is contained in:
		@ -60,21 +60,24 @@ public:
 | 
			
		||||
    void ShowComponents(Entity& selected) 
 | 
			
		||||
	{
 | 
			
		||||
        auto component = selected.GetComponent<IdentifierComponent>();
 | 
			
		||||
        char* buf = new char(component.name.size());
 | 
			
		||||
        strcpy(buf, component.name.c_str());
 | 
			
		||||
        ImGui::InputText("Name:", buf, sizeof(buf), ImGuiInputTextFlags_ReadOnly);
 | 
			
		||||
        ImGui::InputText("Name:", (char*)component.name.c_str(), component.name.size() * sizeof(char), ImGuiInputTextFlags_ReadOnly);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if (selected.HasComponent<TransformComponent>()) {
 | 
			
		||||
            auto& transform = selected.GetComponent<TransformComponent>();
 | 
			
		||||
            if (ImGui::CollapsingHeader("Transform", ImGuiTreeNodeFlags_DefaultOpen)) {
 | 
			
		||||
                ImGui::DragFloat3("Position", glm::value_ptr(transform.Position), 0.01f);
 | 
			
		||||
                ImGui::DragFloat3("Rotation", glm::value_ptr(transform.Rotation), 0.01f);
 | 
			
		||||
                ImGui::DragFloat3("Scale", glm::value_ptr(transform.Scale), 0.01f, 0.0f);
 | 
			
		||||
                ImGui::DragFloat3("Position", glm::value_ptr(transform.Position), 0.1f);
 | 
			
		||||
                ImGui::DragFloat3("Rotation", glm::value_ptr(transform.Rotation), 0.1f);
 | 
			
		||||
                ImGui::DragFloat3("Scale", glm::value_ptr(transform.Scale), 0.1f, 0.0f);
 | 
			
		||||
            }
 | 
			
		||||
            if (selected.HasComponent<RelationComponent>()) {
 | 
			
		||||
                ImGui::Text("Has relation");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if (selected.HasComponent<Render3DComponent>()) {
 | 
			
		||||
            auto& render3d = selected.GetComponent<Render3DComponent>();
 | 
			
		||||
            if (ImGui::CollapsingHeader("Render3D", ImGuiTreeNodeFlags_DefaultOpen)) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user