pthom / hello_imgui

Hello, Dear ImGui: unleash your creativity in app development and prototyping
https://pthom.github.io/hello_imgui
MIT License
604 stars 91 forks source link

Some question about hello_imgui_ini_settings #67

Closed XMNXofficial closed 9 months ago

XMNXofficial commented 10 months ago

hi!👋

I have some question about hello_imgui_ini_settings 😊.

I fond that the option in settings file,they will overwrite the options defined in the code when they be loaded.

Such as I have defined

    p.imGuiWindowParams.showStatusBar = false;

but in the settings file ***.ini is this

[StatusBar]
Show=true
ShowFps=true

In this case, the status bar will still be displayed after the program compiled.

screenshots1

This is my code:

#include <iostream>
#include <vector>
#include "MoneyAPP.hpp"
#include "ui/InformationDisplay.hpp"
extern MoneyAPP* APP = new MoneyAPP;
ImFont* gFont = nullptr;
int main()
{
    HelloImGui::RunnerParams p;
    p.appWindowParams.windowTitle = "MoneyAPP";
    p.appWindowParams.resizable = true;
    p.appWindowParams.windowGeometry.size = { 800,600 };
    p.imGuiWindowParams.defaultImGuiWindowType = HelloImGui::DefaultImGuiWindowType::ProvideFullScreenDockSpace;
    p.dockingParams = show_dockinggui();
    p.dockingParams.layoutCondition = HelloImGui::DockingLayoutCondition::ApplicationStart;

    p.callbacks.LoadAdditionalFonts = []() {
        ImFontGlyphRangesBuilder a;
        static ImVector<ImWchar>b;
        a.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesChineseFull());
        a.BuildRanges(&b);
        gFont = ImGui::GetIO().Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\msyhbd.ttc", 40.0f, nullptr, b.Data); };
    p.imGuiWindowParams.showMenuBar = true;
    p.imGuiWindowParams.showStatusBar = false;
    HelloImGui::Run(p);
    return 0;
}

HelloImGui::DockingParams show_dockinggui()
{
    HelloImGui::DockingParams d;

    std::vector<HelloImGui::DockingSplit> s;
    HelloImGui::DockingSplit test_Space1;
    test_Space1.initialDock = "MainDockSpace";
    test_Space1.newDock = "test_Space1";
    test_Space1.direction = ImGuiDir_Up;
    test_Space1.ratio = 0.5f;
    test_Space1.nodeFlags = ImGuiDockNodeFlags_NoTabBar;
    s.push_back(test_Space1);
    d.dockingSplits = s;

    std::vector<HelloImGui::DockableWindow>w;
    HelloImGui::DockableWindow test_Window1;
    test_Window1.label = "test1";
    test_Window1.dockSpaceName = "test_Space1";
    test_Window1.GuiFunction = [] { show_gui1(); };
    HelloImGui::DockableWindow test_Window2;
    test_Window2.label = "test2";
    test_Window2.dockSpaceName = "MainDockSpace";
    test_Window2.GuiFunction = [] { show_gui2(); };
    test_Window2.imGuiWindowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize;

    w.push_back(test_Window1);
    w.push_back(test_Window2);
    d.dockableWindows = w;

    return d;

}

MoneyAPP::MoneyAPP()
{
    dataServer::server si;
    si.server_host = "127.0.0.1";
    si.server_port = 3306;
    si.server_user = "root";
    si.server_passwd = "123456";
    si.server_database = "MoneyAPP";
    data = new dataServer(si);

}
MoneyAPP::~MoneyAPP()
{

}

Thank you for your help!😊

pthom commented 9 months ago

Hi,

I think you just need to set

runnerParams.imGuiWindowParams.rememberStatusBarSettings = false;

This should be enough!