Demonstrate creating a simple log window with basic filtering.
| 2870 | |
| 2871 | // Demonstrate creating a simple log window with basic filtering. |
| 2872 | static void ShowExampleAppLog(bool* p_open) |
| 2873 | { |
| 2874 | static ExampleAppLog log; |
| 2875 | |
| 2876 | // Demo: add random items (unless Ctrl is held) |
| 2877 | static float last_time = -1.0f; |
| 2878 | float time = ImGui::GetTime(); |
| 2879 | if (time - last_time >= 0.20f && !ImGui::GetIO().KeyCtrl) |
| 2880 | { |
| 2881 | const char* random_words[] = { "system", "info", "warning", "error", "fatal", "notice", "log" }; |
| 2882 | log.AddLog("[%s] Hello, time is %.1f, frame count is %d\n", random_words[rand() % IM_ARRAYSIZE(random_words)], time, ImGui::GetFrameCount()); |
| 2883 | last_time = time; |
| 2884 | } |
| 2885 | |
| 2886 | log.Draw("Example: Log", p_open); |
| 2887 | } |
| 2888 | |
| 2889 | // Demonstrate create a window with multiple child windows. |
| 2890 | static void ShowExampleAppLayout(bool* p_open) |