Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making p_open a parameter instead of a member? #33

Open
Flinterpop opened this issue Nov 5, 2023 · 1 comment
Open

Making p_open a parameter instead of a member? #33

Flinterpop opened this issue Nov 5, 2023 · 1 comment

Comments

@Flinterpop
Copy link

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

@ocornut
Copy link
Owner

ocornut commented May 28, 2024

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).

@ocornut ocornut changed the title Clicking on the Close 'X' in DrawWindow() doesn't close the window Making p_open a parameter instead of a member? May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants