main.cpp 928 B

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