main.cpp 1.1 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 = nullptr;
  13. //int tex_w, tex_h;
  14. //io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);
  15. io.BackendFlags |= ImGuiBackendFlags_RendererHasTextures;
  16. for (int n = 0; n < 20; n++)
  17. {
  18. printf("NewFrame() %d\n", n);
  19. io.DisplaySize = ImVec2(1920, 1080);
  20. io.DeltaTime = 1.0f / 60.0f;
  21. ImGui::NewFrame();
  22. static float f = 0.0f;
  23. ImGui::Text("Hello, world!");
  24. ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
  25. ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
  26. ImGui::ShowDemoWindow(nullptr);
  27. ImGui::Render();
  28. }
  29. printf("DestroyContext()\n");
  30. ImGui::DestroyContext();
  31. return 0;
  32. }