Implementation of memory usage monitor.

This commit is contained in:
brunoherbelin
2020-07-09 12:22:30 +02:00
parent 3cc63d7c54
commit 69cabd385f
3 changed files with 41 additions and 6 deletions

View File

@@ -669,7 +669,7 @@ void ImGuiToolkit::Bar(float value, float in, float out, float min, float max, c
ImVec2 pos0 = ImLerp(bb.Min, bb.Max, 0.1);
ImVec2 pos1 = ImLerp(bb.Min, bb.Max, 0.2);
// ImVec2 pos1 = ImLerp(bb.Min, bb.Max, 0.2);
float step = (bb.Max.x - bb.Min.x) / 100.f;
int i = 0;
for (float tic = bb.Min.x; tic < bb.Max.x; tic += step, ++i) {
@@ -797,15 +797,17 @@ void ImGuiToolkit::ShowStats(bool *p_open, int* p_corner)
{
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_MONO);
if (ImGui::IsMousePosValid())
ImGui::Text("Mouse (%.1f,%.1f)", io.MousePos.x, io.MousePos.y);
else
ImGui::Text("Mouse <invalid>");
// if (ImGui::IsMousePosValid())
// ImGui::Text("Mouse (%.1f,%.1f)", io.MousePos.x, io.MousePos.y);
// else
// ImGui::Text("Mouse <invalid>");
ImGui::Text("Window (%.1f,%.1f)", io.DisplaySize.x, io.DisplaySize.y);
ImGui::Text("HiDPI (retina) %s", io.DisplayFramebufferScale.x > 1.f ? "on" : "off");
// ImGui::Text("HiDPI (retina) %s", io.DisplayFramebufferScale.x > 1.f ? "on" : "off");
// ImGui::Text("DPI Scale (%.1f,%.1f)", io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
ImGui::Text("Rendering %.1f FPS", io.Framerate);
ImGui::Text("Memory %s", SystemToolkit::byte_to_string( SystemToolkit::memory_usage()).c_str() );
// ImGui::Text("Memory %.ld MB", SystemToolkit::memory_usage());
ImGui::PopFont();
if (ImGui::BeginPopupContextWindow())