MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / ShowExampleAppLog

Function ShowExampleAppLog

external/imgui/imgui_demo.cpp:9489–9517  ·  view source on GitHub ↗

Demonstrate creating a simple log window with basic filtering.

Source from the content-addressed store, hash-verified

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

Callers 1

ShowDemoWindowMethod · 0.85

Calls 2

ImVec2Function · 0.85
DrawMethod · 0.45

Tested by

no test coverage detected