| 2168 | } |
| 2169 | |
| 2170 | void ShowDemoWindow(bool* p_open) { |
| 2171 | static bool show_implot_metrics = false; |
| 2172 | static bool show_implot_style_editor = false; |
| 2173 | static bool show_imgui_metrics = false; |
| 2174 | static bool show_imgui_style_editor = false; |
| 2175 | static bool show_imgui_demo = false; |
| 2176 | |
| 2177 | if (show_implot_metrics) { |
| 2178 | ImPlot::ShowMetricsWindow(&show_implot_metrics); |
| 2179 | } |
| 2180 | if (show_implot_style_editor) { |
| 2181 | ImGui::SetNextWindowSize(ImVec2(415,762), ImGuiCond_Appearing); |
| 2182 | ImGui::Begin("Style Editor (ImPlot)", &show_implot_style_editor); |
| 2183 | ImPlot::ShowStyleEditor(); |
| 2184 | ImGui::End(); |
| 2185 | } |
| 2186 | if (show_imgui_style_editor) { |
| 2187 | ImGui::Begin("Style Editor (ImGui)", &show_imgui_style_editor); |
| 2188 | ImGui::ShowStyleEditor(); |
| 2189 | ImGui::End(); |
| 2190 | } |
| 2191 | if (show_imgui_metrics) { |
| 2192 | ImGui::ShowMetricsWindow(&show_imgui_metrics); |
| 2193 | } |
| 2194 | if (show_imgui_demo) { |
| 2195 | ImGui::ShowDemoWindow(&show_imgui_demo); |
| 2196 | } |
| 2197 | ImGui::SetNextWindowPos(ImVec2(50, 50), ImGuiCond_FirstUseEver); |
| 2198 | ImGui::SetNextWindowSize(ImVec2(600, 750), ImGuiCond_FirstUseEver); |
| 2199 | ImGui::Begin("ImPlot Demo", p_open, ImGuiWindowFlags_MenuBar); |
| 2200 | if (ImGui::BeginMenuBar()) { |
| 2201 | if (ImGui::BeginMenu("Tools")) { |
| 2202 | ImGui::MenuItem("Metrics", nullptr, &show_implot_metrics); |
| 2203 | ImGui::MenuItem("Style Editor", nullptr, &show_implot_style_editor); |
| 2204 | ImGui::Separator(); |
| 2205 | ImGui::MenuItem("ImGui Metrics", nullptr, &show_imgui_metrics); |
| 2206 | ImGui::MenuItem("ImGui Style Editor", nullptr, &show_imgui_style_editor); |
| 2207 | ImGui::MenuItem("ImGui Demo", nullptr, &show_imgui_demo); |
| 2208 | ImGui::EndMenu(); |
| 2209 | } |
| 2210 | ImGui::EndMenuBar(); |
| 2211 | } |
| 2212 | //------------------------------------------------------------------------- |
| 2213 | ImGui::Text("ImPlot says hello. (%s)", IMPLOT_VERSION); |
| 2214 | // display warning about 16-bit indices |
| 2215 | static bool showWarning = sizeof(ImDrawIdx)*8 == 16 && (ImGui::GetIO().BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset) == false; |
| 2216 | if (showWarning) { |
| 2217 | ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1,1,0,1)); |
| 2218 | ImGui::TextWrapped("WARNING: ImDrawIdx is 16-bit and ImGuiBackendFlags_RendererHasVtxOffset is false. Expect visual glitches and artifacts! See README for more information."); |
| 2219 | ImGui::PopStyleColor(); |
| 2220 | } |
| 2221 | |
| 2222 | ImGui::Spacing(); |
| 2223 | |
| 2224 | if (ImGui::BeginTabBar("ImPlotDemoTabs")) { |
| 2225 | if (ImGui::BeginTabItem("Plots")) { |
| 2226 | DemoHeader("Line Plots", Demo_LinePlots); |
| 2227 | DemoHeader("Filled Line Plots", Demo_FilledLinePlots); |
no test coverage detected