MCPcopy Create free account
hub / github.com/AlexandreRouma/SDRPlusPlus / ShowExampleAppLog

Function ShowExampleAppLog

core/src/imgui/imgui_demo.cpp:6765–6792  ·  view source on GitHub ↗

Demonstrate creating a simple log window with basic filtering.

Source from the content-addressed store, hash-verified

6763
6764// Demonstrate creating a simple log window with basic filtering.
6765static void ShowExampleAppLog(bool* p_open)
6766{
6767 static ExampleAppLog log;
6768
6769 // For the demo: add a debug button _BEFORE_ the normal log window contents
6770 // We take advantage of a rarely used feature: multiple calls to Begin()/End() are appending to the _same_ window.
6771 // Most of the contents of the window will be added by the log.Draw() call.
6772 ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver);
6773 ImGui::Begin("Example: Log", p_open);
6774 if (ImGui::SmallButton("[Debug] Add 5 entries"))
6775 {
6776 static int counter = 0;
6777 const char* categories[3] = { "info", "warn", "error" };
6778 const char* words[] = { "Bumfuzzled", "Cattywampus", "Snickersnee", "Abibliophobia", "Absquatulate", "Nincompoop", "Pauciloquent" };
6779 for (int n = 0; n < 5; n++)
6780 {
6781 const char* category = categories[counter % IM_ARRAYSIZE(categories)];
6782 const char* word = words[counter % IM_ARRAYSIZE(words)];
6783 log.AddLog("[%05d] [%s] Hello, current time is %.1f, here's a word: '%s'\n",
6784 ImGui::GetFrameCount(), category, ImGui::GetTime(), word);
6785 counter++;
6786 }
6787 }
6788 ImGui::End();
6789
6790 // Actually call in the regular Log helper (which will Begin() into the same window as we just did)
6791 log.Draw("Example: Log", p_open);
6792}
6793
6794//-----------------------------------------------------------------------------
6795// [SECTION] Example App: Simple Layout / ShowExampleAppLayout()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 4

ImVec2Function · 0.85
BeginFunction · 0.85
EndFunction · 0.85
DrawMethod · 0.80

Tested by

no test coverage detected