1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Sample app built with Dear ImGui and ImPlot
// This app uses implot and imgui, but does not output to any backend! It only serves as a proof that an app can be built, linked, and run.
#include "imgui.h"
#include "implot.h"
#include "stdio.h"
int main(int, char**)
{
printf("sample_implot: start\n");
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImPlot::CreateContext();
// Additional imgui initialization needed when no backend is present
ImGui::GetIO().DisplaySize = ImVec2(400.f, 400.f);
ImGui::GetIO().Fonts->Build();
// Render 500 frames
for(int counter = 0; counter < 500; ++counter)
{
ImGui::NewFrame();
if (ImGui::Begin("Hello, world!"))
{
ImGui::Text("Hello again");
if (ImPlot::BeginPlot("My Plot"))
{
static double values[] = {1., 3., 5.};
ImPlot::PlotLine("Values", values, 3);
ImPlot::EndPlot();
}
#ifdef IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES
if (ImPlot::BeginPlot("My Plot (long double)"))
{
static long double values[] = {1., 3., 5.};
ImPlot::PlotLine("Values", values, 3);
ImPlot::EndPlot();
}
#endif
ImGui::End();
}
ImGui::Render();
}
ImPlot::DestroyContext();
ImGui::DestroyContext();
printf("sample_implot: end\n");
return 0;
}
|