main.cpp 954 B

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