diff options
author | Nao Pross <np@0hm.ch> | 2024-02-12 14:52:43 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-02-12 14:52:43 +0100 |
commit | eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d (patch) | |
tree | bc2efa38ff4e350f9a111ac87065cd7ae9a911c7 /src/implot/.github/example_implot.cpp | |
download | fsisotool-eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d.tar.gz fsisotool-eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d.zip |
Move into version control
Diffstat (limited to 'src/implot/.github/example_implot.cpp')
-rw-r--r-- | src/implot/.github/example_implot.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/implot/.github/example_implot.cpp b/src/implot/.github/example_implot.cpp new file mode 100644 index 0000000..9339bab --- /dev/null +++ b/src/implot/.github/example_implot.cpp @@ -0,0 +1,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; +} |