Skip to content

Commit

Permalink
editor GUI improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
sselecirPyM authored and hyv1001 committed Jun 4, 2022
1 parent 75b1611 commit 7cbcde9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 20 deletions.
12 changes: 10 additions & 2 deletions engine/source/editor/include/editor_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ namespace Pilot
private:
std::unordered_map<std::string, std::function<void(std::string, void*)>> m_editor_ui_creator;
std::unordered_map<std::string, unsigned int> m_new_object_index_map;
EditorFileService m_editor_file_service;
std::chrono::time_point<std::chrono::steady_clock> m_last_file_tree_update;
EditorFileService m_editor_file_service;
std::chrono::time_point<std::chrono::steady_clock> m_last_file_tree_update;

bool m_editor_menu_window_open = true;
bool m_asset_window_open = true;
bool m_game_engine_window_open = true;
bool m_file_content_window_open = true;
bool m_detail_window_open = true;
bool m_scene_lights_window_open = true;
bool m_scene_lights_data_window_open = true;
};
} // namespace Pilot
45 changes: 27 additions & 18 deletions engine/source/editor/source/editor_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,11 @@ namespace Pilot

void EditorUI::showEditorUI()
{

bool editor_menu_window_open = true;
bool asset_window_open = true;
bool game_engine_window_open = true;
bool file_content_window_open = true;
bool detail_window_open = true;
bool scene_lights_window_open = true;
bool scene_lights_data_window_open = true;

showEditorMenu(&editor_menu_window_open);
showEditorWorldObjectsWindow(&asset_window_open);
showEditorGameWindow(&game_engine_window_open);
showEditorFileContentWindow(&file_content_window_open);
showEditorDetailWindow(&detail_window_open);
showEditorMenu(&m_editor_menu_window_open);
showEditorWorldObjectsWindow(&m_asset_window_open);
showEditorGameWindow(&m_game_engine_window_open);
showEditorFileContentWindow(&m_file_content_window_open);
showEditorDetailWindow(&m_detail_window_open);
}

void EditorUI::showEditorMenu(bool* p_open)
Expand Down Expand Up @@ -334,6 +325,14 @@ namespace Pilot
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Window"))
{
ImGui::MenuItem("World Objects", nullptr, &m_asset_window_open);
ImGui::MenuItem("Game", nullptr, &m_game_engine_window_open);
ImGui::MenuItem("File Content", nullptr, &m_file_content_window_open);
ImGui::MenuItem("Detail", nullptr, &m_detail_window_open);
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}

Expand All @@ -346,6 +345,9 @@ namespace Pilot

const ImGuiViewport* main_viewport = ImGui::GetMainViewport();

if (!*p_open)
return;

if (!ImGui::Begin("World Objects", p_open, window_flags))
{
ImGui::End();
Expand Down Expand Up @@ -480,6 +482,9 @@ namespace Pilot

const ImGuiViewport* main_viewport = ImGui::GetMainViewport();

if (!*p_open)
return;

if (!ImGui::Begin("Components Details", p_open, window_flags))
{
ImGui::End();
Expand Down Expand Up @@ -522,6 +527,9 @@ namespace Pilot

const ImGuiViewport* main_viewport = ImGui::GetMainViewport();

if (!*p_open)
return;

if (!ImGui::Begin("File Content", p_open, window_flags))
{
ImGui::End();
Expand Down Expand Up @@ -563,6 +571,9 @@ namespace Pilot

const ImGuiViewport* main_viewport = ImGui::GetMainViewport();

if (!*p_open)
return;

if (!ImGui::Begin("Game Engine", p_open, window_flags))
{
ImGui::End();
Expand Down Expand Up @@ -625,8 +636,7 @@ namespace Pilot
if (g_is_editor_mode)
{
ImGui::PushID("Editor Mode");
ImGui::Button("Editor Mode");
if (ImGui::IsItemClicked(ImGuiMouseButton_Left))
if (ImGui::Button("Editor Mode"))
{
g_is_editor_mode = false;
g_editor_global_context.m_scene_manager->drawSelectedEntityAxis();
Expand All @@ -637,8 +647,7 @@ namespace Pilot
}
else
{
ImGui::Button("Game Mode");
if (ImGui::IsItemClicked(ImGuiMouseButton_Left))
if (ImGui::Button("Game Mode"))
{
g_is_editor_mode = true;
g_editor_global_context.m_scene_manager->drawSelectedEntityAxis();
Expand Down

0 comments on commit 7cbcde9

Please sign in to comment.