1
0
mirror of synced 2025-02-17 18:59:21 +01:00

Added very basic Welcome screen

This commit is contained in:
WerWolv 2021-01-27 01:10:13 +01:00
parent 8990fad85a
commit 47ca69b80e
2 changed files with 31 additions and 8 deletions

View File

@ -32,6 +32,8 @@ namespace hex {
void frameBegin();
void frameEnd();
void drawWelcomeScreen();
void initGLFW();
void initImGui();
void deinitGLFW();

View File

@ -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);