MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ShowExampleAppLog

Function ShowExampleAppLog

3rdparty/imgui/src/imgui_demo.cpp:9472–9500  ·  view source on GitHub ↗

Demonstrate creating a simple log window with basic filtering.

Source from the content-addressed store, hash-verified

9470
9471// Demonstrate creating a simple log window with basic filtering.
9472static void ShowExampleAppLog(bool* p_open)
9473{
9474 static ExampleAppLog log;
9475
9476 // For the demo: add a debug button _BEFORE_ the normal log window contents
9477 // We take advantage of a rarely used feature: multiple calls to Begin()/End() are appending to the _same_ window.
9478 // Most of the contents of the window will be added by the log.Draw() call.
9479 ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver);
9480 ImGui::Begin("Example: Log", p_open);
9481 IMGUI_DEMO_MARKER("Examples/Log");
9482 if (ImGui::SmallButton("[Debug] Add 5 entries"))
9483 {
9484 static int counter = 0;
9485 const char* categories[3] = { "info", "warn", "error" };
9486 const char* words[] = { "Bumfuzzled", "Cattywampus", "Snickersnee", "Abibliophobia", "Absquatulate", "Nincompoop", "Pauciloquent" };
9487 for (int n = 0; n < 5; n++)
9488 {
9489 const char* category = categories[counter % IM_COUNTOF(categories)];
9490 const char* word = words[counter % IM_COUNTOF(words)];
9491 log.AddLog("[%05d] [%s] Hello, current time is %.1f, here's a word: '%s'\n",
9492 ImGui::GetFrameCount(), category, ImGui::GetTime(), word);
9493 counter++;
9494 }
9495 }
9496 ImGui::End();
9497
9498 // Actually call in the regular Log helper (which will Begin() into the same window as we just did)
9499 log.Draw("Example: Log", p_open);
9500}
9501
9502//-----------------------------------------------------------------------------
9503// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 4

BeginFunction · 0.85
EndFunction · 0.85
ImVec2Function · 0.50
DrawMethod · 0.45

Tested by

no test coverage detected