main.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. int main(int, char**)
  7. {
  8. IMGUI_CHECKVERSION();
  9. ImGui::CreateContext();
  10. ImGuiIO& io = ImGui::GetIO();
  11. // Build atlas
  12. unsigned char* tex_pixels = NULL;
  13. int tex_w, tex_h;
  14. io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);
  15. for (int n = 0; n < 20; n++)
  16. {
  17. printf("NewFrame() %d\n", n);
  18. io.DisplaySize = ImVec2(1920, 1080);
  19. io.DeltaTime = 1.0f / 60.0f;
  20. ImGui::NewFrame();
  21. static float f = 0.0f;
  22. ImGui::Text("Hello, world!");
  23. ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
  24. ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
  25. ImGui::ShowDemoWindow(NULL);
  26. ImGui::Render();
  27. }
  28. printf("DestroyContext()\n");
  29. ImGui::DestroyContext();
  30. return 0;
  31. }