mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-17 11:55:35 +00:00
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
// dear imgui: "null" example application
|
|
// (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT)
|
|
// This is useful to test building, but you cannot interact with anything here!
|
|
#include "imgui.h"
|
|
#include <stdio.h>
|
|
#include "imgui_impl_null.h"
|
|
|
|
int main(int, char**)
|
|
{
|
|
IMGUI_CHECKVERSION();
|
|
|
|
ImGui::CreateContext();
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
|
ImGui_ImplNullPlatform_Init();
|
|
ImGui_ImplNullRender_Init();
|
|
|
|
for (int n = 0; n < 20; n++)
|
|
{
|
|
printf("NewFrame() %d\n", n);
|
|
ImGui_ImplNullPlatform_NewFrame();
|
|
ImGui_ImplNullRender_NewFrame();
|
|
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(nullptr);
|
|
|
|
ImGui::Render();
|
|
}
|
|
|
|
printf("DestroyContext()\n");
|
|
ImGui_ImplNullRender_Shutdown();
|
|
ImGui_ImplNullPlatform_Shutdown();
|
|
ImGui::DestroyContext();
|
|
return 0;
|
|
}
|