main.cpp 888 B

123456789101112131415161718192021222324252627282930313233
  1. // ImGui - null/dummy example application (compile and link imgui with no inputs, no outputs)
  2. #include "imgui.h"
  3. #include <stdio.h>
  4. int main(int, char**)
  5. {
  6. ImGuiIO& io = ImGui::GetIO();
  7. // Build atlas
  8. unsigned char* tex_pixels = NULL;
  9. int tex_w, tex_h;
  10. io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);
  11. for (int n = 0; n < 50; n++)
  12. {
  13. printf("NewFrame() %d\n", n);
  14. io.DisplaySize = ImVec2(1920, 1080);
  15. io.DeltaTime = 1.0f / 60.0f;
  16. ImGui::NewFrame();
  17. static float f = 0.0f;
  18. ImGui::Text("Hello, world!");
  19. ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
  20. ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
  21. ImGui::ShowDemoWindow(NULL);
  22. ImGui::Render();
  23. }
  24. printf("Shutdown()\n");
  25. ImGui::Shutdown();
  26. return 0;
  27. }