ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
60.62k stars 10.23k forks source link

ImGui Windows not showing #4287

Closed androbytes closed 3 years ago

androbytes commented 3 years ago

Sorry if this a stupid question, but, how does DockSpace work? I have no idea what a ImGuiID is but I'd just like to make a opengl window a dockspace, Thanks!

AidanSun05 commented 3 years ago

Please be more specific.

First of all, are they really errors, or are they warnings? These are terms that people constantly use interchangeably, yet they are completely different.

What kind of error/warning is it? Linker errors (LNK2001/2019)? "[something].dll not found"? Please attach the full message text, and include all of the messages you encountered.

androbytes commented 3 years ago

It can't find ImGui files. From #include

AidanSun05 commented 3 years ago

Which ones?

androbytes commented 3 years ago

Can't find any

AidanSun05 commented 3 years ago

Usually, the Visual Studio examples work out of the box, no setup required. Perhaps your include path is set wrong.

In your VS Property Pages, go to C++ > General and look at the "Additional Include Directories" option. It should match the entry in my screenshot below:

image

androbytes commented 3 years ago

Yes it does

AidanSun05 commented 3 years ago

Are the #include errors from linting (red squiggles under the directives) or from compiling?

Try to run your project with the green Run Button. Does it compile successfully? (IntelliSense glitches out in VS a lot, this error might not be real.)

androbytes commented 3 years ago

Uh, I can't open any files and yes I do click the run button, thats what I always do.

androbytes commented 3 years ago

Oh I can open them now

AidanSun05 commented 3 years ago

Did you change anything in any way?

androbytes commented 3 years ago

No, but suddenly it works

androbytes commented 3 years ago

Now i got an sdk error :/

androbytes commented 3 years ago

Where do you find the SDK version 8.1 I only see version 10

AidanSun05 commented 3 years ago

The SLN examples in the main repo are pretty outdated in terms of SDKs and toolchains, try upgrading your platform toolset to v142. Older versions might not work with the Win10 SDK, they may be trying to use the Win8.1 SDK.

image

To get to the menu above, right-click your top-most solution in the Solution Explorer, then select "Retarget solution".

image

androbytes commented 3 years ago

Okay that did work on that project but my project doesn't work. Do you need some pictures of files or anything?

AidanSun05 commented 3 years ago

To clarify, the examples can run perfectly now, but your own code still has the issue from yesterday, correct?

androbytes commented 3 years ago

Yes.

androbytes commented 3 years ago

It worked the day before and I didn't change anything and now it doesn't work

ocornut commented 3 years ago

FYI every message you are posting here are being sent to the inbox of 1000 people. If either of you have the goodwill to help @AnnoyingB with general programming help, please find a suitable chatting spot, and then you may report the results here.

jrynkiew commented 3 years ago

You need to define the dockspaces first, and then add windows to them. Alternatively you can use a library like hello_imgui which will make your life easier.

To do it yourself from scratch, I wrote something like this: (it's probably not optimal but it works)

if(interface->setup_docking)
{
    ImGui::DockBuilderAddNode(interface->dockspaceID, ImGuiDockNodeFlags_DockSpace | ImGuiDockNodeFlags_NoWindowMenuButton); // Add empty node
    ImGui::DockBuilderSetNodeSize(interface->dockspaceID, ImGui::GetCurrentContext()->CurrentViewport->Size);

    ImGuiID dock_main_id = interface->dockspaceID; // This variable will track the document node, however we are not using it here as we aren't docking anything into it.
    ImGuiID dock_id_left_menu = ImGui::DockBuilderSplitNode(dock_main_id, ImGuiDir_Left, (interface->getStyle()->iconSize.x / ImGui::GetCurrentContext()->CurrentViewport->Size.x), NULL, &dock_main_id);
    ImGuiID dock_id_right_panel = ImGui::DockBuilderSplitNode(dock_main_id, ImGuiDir_Right, 0.25f, NULL, &dock_main_id);

    ImGui::DockBuilderDockWindow("MainMenu", dock_id_left_menu);
    ImGui::DockBuilderDockWindow("Introduction", dock_id_right_panel);

    ImGui::DockBuilderFinish(interface->dockspaceID);

    ImGuiDockNode* node = ImGui::DockBuilderGetNode(dock_id_left_menu);
 node->LocalFlags |= ImGuiDockNodeFlags_NoTabBar | ImGuiDockNodeFlags_NoResize;

    interface->setup_docking = false;
}

}

Then just

ImGui::Begin("MainMenu", NULL);

And "MainMenu" will be docked

Wysłane z mojego BlackBerry — najbezpieczniejszego urządzenia mobilnego Od: @. Wysłano: 12 lipca 2021 21:55 Do: @. Odp. do: @. DW: @.; @.*** Temat: Re: [ocornut/imgui] ImGui Windows not showing (#4287)

after some tweaking it's working and the dockspace works aswell. is there any way to make it not be made at the bottom of the screen and also automatically set it's dockspace place?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ocornut/imgui/issues/4287#issuecomment-878551315, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APA7H47UFNUGYCNFKBYBDLDTXNCBHANCNFSM47Q3POQQ.

androbytes commented 3 years ago

Oh okay thanks