Skip to content

Commit

Permalink
feat: worldoutliner create/destroy entity
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanbaburajan committed Oct 26, 2023
1 parent 1b397fd commit 436e955
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Editor/Panels/WorldOutliner.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ namespace DT

ImGui::Begin("World Outliner", &isOpen);

// Entity control
if (ImGui::Button("Create Entity", ImVec2(ImGui::GetWindowSize().x, 0.0f)))
selectedEntity = sceneManager->activeScene.CreateEntity();
if (ImGui::Button("Destroy Entity", ImVec2(ImGui::GetWindowSize().x, 0.0f)))
sceneManager->activeScene.DestroyEntity(selectedEntity).Fatal("WorldOutlinerPanel::Tick()");

// Entity list
for (Entity entity : sceneManager->activeScene.GetEntities())
{
std::string label;
Expand Down
1 change: 1 addition & 0 deletions Engine/ECS/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace DT
{
PROFILE();

components.insert(std::make_pair(entityCounter, std::unordered_map<std::type_index, std::shared_ptr<Component>>()));
return entityCounter++;
}

Expand Down

0 comments on commit 436e955

Please sign in to comment.