Further improved UI/UX of welcome screen

This commit is contained in:
WerWolv
2021-01-30 23:02:03 +01:00
parent 5c7a529fa1
commit 073eee8fab
5 changed files with 38 additions and 9 deletions

View File

@@ -147,6 +147,12 @@ namespace hex {
this->openFile(path);
this->getWindowOpenState() = true;
});
} else if (std::any_cast<const char*>(name) == std::string("Open Project")) {
View::openFileBrowser("Open Project", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".hexproj", [this](auto path) {
ProjectFile::load(path);
View::postEvent(Events::ProjectFileLoad);
this->getWindowOpenState() = true;
});
}
});
}

View File

@@ -188,15 +188,12 @@ namespace hex {
switch (theme) {
default:
case 0: /* Dark theme */
ImGui::StyleColorsDark();
this->m_textEditor.SetPalette(TextEditor::GetDarkPalette());
break;
case 1: /* Light theme */
ImGui::StyleColorsLight();
this->m_textEditor.SetPalette(TextEditor::GetLightPalette());
break;
case 2: /* Classic theme */
ImGui::StyleColorsClassic();
this->m_textEditor.SetPalette(TextEditor::GetRetroBluePalette());
break;
}

View File

@@ -66,11 +66,33 @@ namespace hex {
}
#endif
ContentRegistry::Settings::load();
View::postEvent(Events::SettingsChanged);
this->initGLFW();
this->initImGui();
ImGui::GetStyle().Colors[ImGuiCol_DockingEmptyBg] = ImGui::GetStyle().Colors[ImGuiCol_WindowBg];
EventManager::subscribe(Events::SettingsChanged, this, [](auto) -> std::any {
int theme = ContentRegistry::Settings::getSettingsData()["Interface"]["Color theme"];
switch (theme) {
default:
case 0: /* Dark theme */
ImGui::StyleColorsDark();
break;
case 1: /* Light theme */
ImGui::StyleColorsLight();
break;
case 2: /* Classic theme */
ImGui::StyleColorsClassic();
break;
}
ImGui::GetStyle().Colors[ImGuiCol_DockingEmptyBg] = ImGui::GetStyle().Colors[ImGuiCol_WindowBg];
return { };
});
ContentRegistry::Settings::load();
View::postEvent(Events::SettingsChanged);
}
Window::~Window() {
@@ -83,6 +105,8 @@ namespace hex {
ContentRegistry::Views::getEntries().clear();
this->deinitPlugins();
EventManager::unsubscribe(Events::SettingsChanged, this);
}
void Window::loop() {
@@ -272,6 +296,8 @@ namespace hex {
{
if (ImGui::BulletHyperlink("Open File"))
EventManager::post(Events::OpenWindow, "Open File");
if (ImGui::BulletHyperlink("Open Project"))
EventManager::post(Events::OpenWindow, "Open Project");
}
ImGui::TableNextRow(ImGuiTableRowFlags_None, 100);
ImGui::TableNextColumn();