• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // dear imgui: "null" example application
2 // (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT)
3 // This is useful to test building, but you cannot interact with anything here!
4 #include "imgui.h"
5 #include <stdio.h>
6 
main(int,char **)7 int main(int, char**)
8 {
9     IMGUI_CHECKVERSION();
10     ImGui::CreateContext();
11     ImGuiIO& io = ImGui::GetIO();
12 
13     // Build atlas
14     unsigned char* tex_pixels = NULL;
15     int tex_w, tex_h;
16     io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);
17 
18     for (int n = 0; n < 20; n++)
19     {
20         printf("NewFrame() %d\n", n);
21         io.DisplaySize = ImVec2(1920, 1080);
22         io.DeltaTime = 1.0f / 60.0f;
23         ImGui::NewFrame();
24 
25         static float f = 0.0f;
26         ImGui::Text("Hello, world!");
27         ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
28         ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
29         ImGui::ShowDemoWindow(NULL);
30 
31         ImGui::Render();
32     }
33 
34     printf("DestroyContext()\n");
35     ImGui::DestroyContext();
36     return 0;
37 }
38