1
0
mirror of https://github.com/Drezil/imgui.git synced 2024-12-24 16:46:36 +00:00
imgui/examples/example_null/main.cpp

38 lines
1.0 KiB
C++
Raw Normal View History

// dear imgui: "null" example application
2019-06-11 14:11:19 +00:00
// (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT)
2019-04-08 17:16:45 +00:00
// This is useful to test building, but you cannot interact with anything here!
#include "imgui.h"
#include <stdio.h>
int main(int, char**)
{
IMGUI_CHECKVERSION();
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);
2019-04-08 17:16:45 +00:00
for (int n = 0; n < 20; 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;
}