From cf9b893841ba8e9e380332825605735423d3cab0 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 23 Dec 2017 13:40:01 +0100 Subject: [PATCH] Examples: Added null_example/ which is helpful for quick testing on multiple compilers/settings without relyong on graphics library. --- examples/null_example/build_win32.bat | 3 +++ examples/null_example/main.cpp | 33 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 examples/null_example/build_win32.bat create mode 100644 examples/null_example/main.cpp diff --git a/examples/null_example/build_win32.bat b/examples/null_example/build_win32.bat new file mode 100644 index 00000000..7bb78232 --- /dev/null +++ b/examples/null_example/build_win32.bat @@ -0,0 +1,3 @@ +@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. +mkdir Debug +cl /nologo /Zi /MD /I ..\.. *.cpp ..\..\*.cpp /FeDebug/null_example.exe /FoDebug/ /link gdi32.lib shell32.lib diff --git a/examples/null_example/main.cpp b/examples/null_example/main.cpp new file mode 100644 index 00000000..b12f75c9 --- /dev/null +++ b/examples/null_example/main.cpp @@ -0,0 +1,33 @@ +// ImGui - null/dummy example application (compile and link imgui with no inputs, no outputs) +#include +#include + +int main(int, char**) +{ + ImGuiIO& io = ImGui::GetIO(); + + // Build atlas + unsigned char* tex_pixels = NULL; + int tex_w, tex_h; + io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); + + for (int n = 0; n < 50; n++) + { + printf("NewFrame() %d\n", n); + io.DisplaySize = ImVec2(1920, 1080); + io.DeltaTime = 1.0f / 60.0f; + ImGui::NewFrame(); + + static float f = 0.0f; + ImGui::Text("Hello, world!"); + ImGui::SliderFloat("float", &f, 0.0f, 1.0f); + ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); + ImGui::ShowTestWindow(NULL); + + ImGui::Render(); + } + + printf("Shutdown()\n"); + ImGui::Shutdown(); + return 0; +}