pthom / hello_imgui

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

Two questions about HELLOIMGUI_USE_SDL_DIRECTX11 and ImGuiConfigFlags_ViewportsEnable #15

Closed MichaelKv closed 3 years ago

MichaelKv commented 3 years ago

Hello. I have two questions.

  1. What is HELLOIMGUI_USE_SDL_DIRECTX11 for? It does build but there is no such a backend so FactorRunner emits an exception.
  2. I have uncommented io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; line in void SetupDefaultImGuiConfig() and the hello_world.exe application window content gets stuck to the upper left corner of the primary monitor (I have two monitors). I can move the application window and resize it. The content resizes but does not move. May it be fixed? The hello_imgui_demodocking.exe is kind of works but the behavior of the fps line is strange (it is stuck to a constant position too). hello_imgui_demo_minimal.exe behaves the same way as described in (2). hello_imgui_demo_classic.exe work normally (at least I have not noticed an unusual behavior).
pthom commented 3 years ago

Hi,

Thanks for the detailed description.

  1. I have removed HELLOIMGUI_USE_SDL_DIRECTX11 : it was here, but not implemented; sorry for that (pull requests that add interesting features like this are very welcome of course ;-)

  2. I have fixed the issue with ImGuiConfigFlags_ViewportsEnable: see https://github.com/pthom/hello_imgui/commit/53e9262d22e02346dee2dafd677d620c7b84dd3b The demo hello_imgui_demodocking will show it working.

Remark: you do not need to modify SetupDefaultImGuiConfig() in hello_imgui in order to activate it; you can simply write this somewhere in your initialization:

    HelloImGui::RunnerParams runnerParams;

    ...

    runnerParams.callbacks.SetupImGuiConfig = [] {
        ImGuiIO& io = ImGui::GetIO();
        io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
#ifndef __EMSCRIPTEN__
        io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
#endif
    };

Please tell me if the issue is fixed on your side :-)

MichaelKv commented 3 years ago

It works now. Thank you. But why do you use exception in FactorRunner if there is no backend? I do not think an application can work in this case at all so it would be more logical to emit an error in this case during the compilation.

pthom commented 3 years ago

See c463e934f8764e75cb047ac5f594d40e13459022 , I added a check for that.

I close this issue, since everything should be ok now