diff --git a/include/window.hpp b/include/window.hpp index e8add37e1..6d80f90e7 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -32,6 +32,8 @@ namespace hex { void frameBegin(); void frameEnd(); + void drawWelcomeScreen(); + void initGLFW(); void initImGui(); void deinitGLFW(); diff --git a/source/window.cpp b/source/window.cpp index 4ea0898eb..9443d124a 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -94,16 +94,18 @@ namespace hex { call(); View::getDeferedCalls().clear(); - for (auto &view : ContentRegistry::Views::getEntries()) { - if (!view->getWindowOpenState()) - continue; + if (SharedData::currentProvider != nullptr) { + for (auto &view : ContentRegistry::Views::getEntries()) { + if (!view->getWindowOpenState()) + continue; - auto minSize = view->getMinSize(); - minSize.x *= this->m_globalScale; - minSize.y *= this->m_globalScale; + auto minSize = view->getMinSize(); + minSize.x *= this->m_globalScale; + minSize.y *= this->m_globalScale; - ImGui::SetNextWindowSizeConstraints(minSize, view->getMaxSize()); - view->drawContent(); + ImGui::SetNextWindowSizeConstraints(minSize, view->getMaxSize()); + view->drawContent(); + } } View::drawCommonInterfaces(); @@ -218,6 +220,21 @@ namespace hex { Window::s_currShortcut = { -1, -1 }; } + ImGui::GetWindowDockID() + if (SharedData::currentProvider == nullptr) { + char title[256]; + ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", ImGui::GetCurrentWindow()->Name, ImGui::GetID("MainDock")); + if (ImGui::Begin(title)) { + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10 * this->m_globalScale, 10 * this->m_globalScale)); + if (ImGui::BeginChild("Welcome Screen", ImVec2(0, 0), ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_NoDecoration)) { + this->drawWelcomeScreen(); + } + ImGui::EndChild(); + ImGui::PopStyleVar(); + } + ImGui::End(); + } + } ImGui::End(); } @@ -240,6 +257,10 @@ namespace hex { glfwSwapBuffers(this->m_window); } + void Window::drawWelcomeScreen() { + ImGui::TextColored(ImGui::GetStyleColorVec4(ImGuiCol_HeaderActive), "Welcome to ImHex!"); + } + void Window::initGLFW() { glfwSetErrorCallback([](int error, const char* desc) { fprintf(stderr, "Glfw Error %d: %s\n", error, desc);