jvcleave / ofxImGui

Use ImGui in openFrameworks
299 stars 123 forks source link

Docking #95

Closed MacFurax closed 4 years ago

MacFurax commented 5 years ago

Hi,

I'have created a branch to integrate docking version of ImGui, if you are interrested to integrate it in your repo.

I don't know how to provide an example with a make file. Is it a OpenframeWorks way of doing ?

This is m'y first pull requête, notamment sur how tout do it.

Regards,

Constant

jvcleave commented 4 years ago

closing this as I am going to delete the develop branch in favor of just keeping master, and imgui-latest

if you are finished with this - feel free to resubmit to the master branch if you like.

Makefiles for examples aren't required - typically these come from the projectgenerator.

moebiussurfing commented 4 years ago

Hi,

I'have created a branch to integrate docking version of ImGui, if you are interrested to integrate it in your repo.

I don't know how to provide an example with a make file. Is it a OpenframeWorks way of doing ?

This is m'y first pull requête, notamment sur how tout do it.

Regards,

Constant

hey @MacFurax , what branch are you using this days?

I am frustrated because when using docking on the jvcleave/ofxImGui/ repo I can't make that stores the windows/tabs layout on exit.

I want to use the helpers because I use a lot the ofParameterGroup to handle settings. On the 'demo example' it handles docked windows fine and layout store/recall it's working. On the helpers example I can't make it work the save/recall.

I have seen on this pull request some commits from you about this problem. I am lost... (Also trying to make my own addon with ImGui port with ofParameters)

Any idea about what fork you recommends to me? Your help it's really appreciated.

moebiussurfing commented 4 years ago

I got it @MacFurax ! Thanks for sharing!

Your docking branch works perfect. Then docking layout is auto storing/recall fine on exit/restart.

If I don't miss anything.. the official repo do not has your updates. It would be nice, as @jvcleave says, that you re-submit the pull request (but to the master branch) with this features.

(Your widgets are nice too! I have some big toggle button and a matrix of buttons selector reading an int)

//h
ofParameterGroup g1{ "group1" };
ofParameterGroup g2{ "group2" };
ofParameter<int> myInt1{ "int1", 0, 0, 100 };
ofParameter<int> myInt2{ "int2", 0, 0, 10 };
ofParameter<int> myInt3{ "int3", 0, 0, 10 };
ofParameter<float> slider1{ "slider1", 0, 0, 1 };
ofParameter<float> slider2{ "slider2", 0, 0, 1 };

//setup
gui.setup();
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;

//draw
ofxImGui::Settings mainSettings;

if (ofxImGui::BeginWindow("Helperssss", mainSettings, false))
{
    ImGui::Text("%.1f FPS (%.3f ms/frame)", ofGetFrameRate(), 1000.0f / ImGui::GetIO().Framerate);

    if (ofxImGui::BeginTree(this->colors, mainSettings))
    {
        ofxImGui::AddParameter(this->background, false);
        ofxImGui::AddParameter(this->foreground);
        ImVec2 v{ 20,100 };
        ofxImGui::AddVSlider(this->slider1, v);
        ofxImGui::AddVSlider(this->slider2, v);
        ofxImGui::AddGroup(this->g1, mainSettings);
        ofxImGui::AddStepper(this->myInt1);
        ofxImGui::AddKnob("Power", this->slider1);
        ofxImGui::AddKnob(this->slider2);
        ofxImGui::AddGroup(this->g2, mainSettings);

        ofxImGui::EndTree(mainSettings);
    }
}
ofxImGui::EndWindow(mainSettings);

imGui