ocornut / imgui_club

Nice things to use along dear imgui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Making p_open a parameter instead of a member?

Flinterpop opened this issue · comments

I am new to GitHub and am not yet sure how to upload a suggested code change. Thus I've just provided it as an issue:
I fixed this for my purposes but it is a breakings change. On the other hand it now seems to match your overall system for handling window closing.

Clicking close window 'X' on DrawWindow() doesn't close the window.
Fix as follows:

  1. Add bool* p_open to parameter list of DrawOpen on line 188 as follows:
    Line 188 void DrawWindow(bool* p_open, const char* title, void* mem_data, size_t mem_size, size_t base_display_addr = 0x0000)

  2. Change Lines 195 as follows: (replace &Open with p_open)
    if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar))
    if (ImGui::Begin(title, p_open, ImGuiWindowFlags_NoScrollbar))

  3. You could remove boolean Open from the remainder of the file.

Brad

commented

The way it was initially designed it that you can read and write to that bool Open flag in the structure, but you are correct this is quite non-idiomatic with how we do most things in imgui land (generally speaking memory editor is old code at this point).