mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-23 02:04:22 +00:00
Examples: Added null_example/ which is helpful for quick testing on multiple compilers/settings without relyong on graphics library.
This commit is contained in:
parent
46dcd9aa50
commit
cf9b893841
2 changed files with 36 additions and 0 deletions
33
examples/null_example/main.cpp
Normal file
33
examples/null_example/main.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// ImGui - null/dummy example application (compile and link imgui with no inputs, no outputs)
|
||||
#include <imgui.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
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::ShowTestWindow(NULL);
|
||||
|
||||
ImGui::Render();
|
||||
}
|
||||
|
||||
printf("Shutdown()\n");
|
||||
ImGui::Shutdown();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue