protot/3rdparty/imgui/examples/example_null/main.cpp

36 lines
958 B
C++
Raw Permalink Normal View History

2018-12-15 09:50:47 +01:00
// dear imgui: null/dummy example application (compile and link imgui with no inputs, no outputs)
2018-02-12 21:35:44 +01:00
#include "imgui.h"
#include <stdio.h>
int main(int, char**)
{
2018-12-15 09:50:47 +01:00
IMGUI_CHECKVERSION();
2018-02-12 21:35:44 +01:00
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
// Build atlas
unsigned char* tex_pixels = NULL;
int tex_w, tex_h;
io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);
for (int n = 0; n < 50; n++)
{
printf("NewFrame() %d\n", n);
io.DisplaySize = ImVec2(1920, 1080);
io.DeltaTime = 1.0f / 60.0f;
ImGui::NewFrame();
static float f = 0.0f;
ImGui::Text("Hello, world!");
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
ImGui::ShowDemoWindow(NULL);
ImGui::Render();
}
printf("DestroyContext()\n");
ImGui::DestroyContext();
return 0;
}