MCPcopy Create free account
hub / github.com/clementgallet/libTAS / ShowExampleAppLog

Function ShowExampleAppLog

src/external/imgui/imgui_demo.cpp:7400–7428  ·  view source on GitHub ↗

Demonstrate creating a simple log window with basic filtering.

Source from the content-addressed store, hash-verified

7398
7399// Demonstrate creating a simple log window with basic filtering.
7400static void ShowExampleAppLog(bool* p_open)
7401{
7402 static ExampleAppLog log;
7403
7404 // For the demo: add a debug button _BEFORE_ the normal log window contents
7405 // We take advantage of a rarely used feature: multiple calls to Begin()/End() are appending to the _same_ window.
7406 // Most of the contents of the window will be added by the log.Draw() call.
7407 ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver);
7408 ImGui::Begin("Example: Log", p_open);
7409 IMGUI_DEMO_MARKER("Examples/Log");
7410 if (ImGui::SmallButton("[Debug] Add 5 entries"))
7411 {
7412 static int counter = 0;
7413 const char* categories[3] = { "info", "warn", "error" };
7414 const char* words[] = { "Bumfuzzled", "Cattywampus", "Snickersnee", "Abibliophobia", "Absquatulate", "Nincompoop", "Pauciloquent" };
7415 for (int n = 0; n < 5; n++)
7416 {
7417 const char* category = categories[counter % IM_ARRAYSIZE(categories)];
7418 const char* word = words[counter % IM_ARRAYSIZE(words)];
7419 log.AddLog("[%05d] [%s] Hello, current time is %.1f, here's a word: '%s'\n",
7420 ImGui::GetFrameCount(), category, ImGui::GetTime(), word);
7421 counter++;
7422 }
7423 }
7424 ImGui::End();
7425
7426 // Actually call in the regular Log helper (which will Begin() into the same window as we just did)
7427 log.Draw("Example: Log", p_open);
7428}
7429
7430//-----------------------------------------------------------------------------
7431// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 3

ImVec2Function · 0.85
GetTimeFunction · 0.85
DrawMethod · 0.80

Tested by

no test coverage detected