Skip to content

Commit

Permalink
auto fit
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonese committed Nov 8, 2024
1 parent 7cc7357 commit 44d5974
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions LuaSTG/LuaSTG/Debugger/ImGuiExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,18 @@ namespace imgui {
void show(bool* is_open = nullptr) {
#define format_size(x) (bytes_count_to_string(x).c_str())
if (is_open == nullptr || (is_open != nullptr && *is_open)) {
if (ImGui::Begin("Memory Usage", is_open, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Checkbox("More Informations", &more_details);
if (want_fit_window_size) {
want_fit_window_size = false;
ImGui::SetNextWindowSize(ImVec2(), ImGuiCond_Always);
}
if (ImGui::Begin("Memory Usage", is_open)) {
if (ImGui::Checkbox("More Informations", &more_details)) {
want_fit_window_size = true;
}
ImGui::SameLine();
if (ImGui::Button("Auto Size")) {
want_fit_window_size = true;
}
if (ImGui::CollapsingHeader("Global", ImGuiTreeNodeFlags_DefaultOpen)) {
MEMORYSTATUSEX info = { sizeof(MEMORYSTATUSEX) };
if (GlobalMemoryStatusEx(&info)) {
Expand Down Expand Up @@ -150,6 +160,7 @@ namespace imgui {
protected:
MemoryUsageWindow() = default;
private:
bool want_fit_window_size{ true };
bool more_details{ true };
bool process_memory_counters_v3{ true };
bool process_memory_counters_v2{ true };
Expand Down

0 comments on commit 44d5974

Please sign in to comment.