Skip to content

Commit

Permalink
** DO NOT MERGE ** Crude font demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedmd committed Jan 26, 2021
1 parent 131fd5f commit a3415c9
Show file tree
Hide file tree
Showing 21 changed files with 177 additions and 7 deletions.
4 changes: 4 additions & 0 deletions examples/example_allegro5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ int main(int, char**)
}
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplAllegro5_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_apple_metal/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,17 @@ - (void)drawInMTKView:(MTKView*)view
id <MTLRenderCommandEncoder> renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
[renderEncoder pushDebugGroup:@"ImGui demo"];

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplMetal_NewFrame(renderPassDescriptor);
#if TARGET_OS_OSX
ImGui_ImplOSX_NewFrame(view);
#endif
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_apple_opengl2/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ -(void)prepareOpenGL

-(void)updateAndDrawDemoView
{
ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplOSX_NewFrame(self);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// Our state (make them static = more or less global) as a convenience to keep the example terse.
static bool show_demo_window = true;
static bool show_another_window = false;
Expand Down
4 changes: 4 additions & 0 deletions examples/example_emscripten_opengl3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ void main_loop(void* arg)
// Capture events here, based on io.WantCaptureMouse and io.WantCaptureKeyboard
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame(g_Window);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_glfw_metal/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ int main(int, char**)
id <MTLRenderCommandEncoder> renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
[renderEncoder pushDebugGroup:@"ImGui demo"];

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplMetal_NewFrame(renderPassDescriptor);
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_glfw_opengl2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,15 @@ int main(int, char**)
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
glfwPollEvents();

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
6 changes: 5 additions & 1 deletion examples/example_glfw_opengl3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int main(int, char**)
// - Read 'docs/FONTS.md' for more instructions and details.
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
//io.Fonts->AddFontDefault();
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
Expand All @@ -149,11 +149,15 @@ int main(int, char**)
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
glfwPollEvents();

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
6 changes: 5 additions & 1 deletion examples/example_glfw_vulkan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

//#define IMGUI_UNLIMITED_FRAME_RATE
#ifdef _DEBUG
#define IMGUI_VULKAN_DEBUG_REPORT
//#define IMGUI_VULKAN_DEBUG_REPORT
#endif

static VkAllocationCallbacks* g_Allocator = NULL;
Expand Down Expand Up @@ -480,6 +480,8 @@ int main(int, char**)
}
}

ImGui::UpdateFontDemo();

// Upload Fonts
if (io.Fonts->IsDirty())
UpdateFontsTexture(wd);
Expand Down Expand Up @@ -525,6 +527,8 @@ int main(int, char**)
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_glut_opengl2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);

void my_display_code()
{
ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down Expand Up @@ -66,6 +68,8 @@ void my_display_code()

void glut_display_func()
{
ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplGLUT_NewFrame();
Expand Down
4 changes: 4 additions & 0 deletions examples/example_marmalade/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ int main(int, char**)
s3eKeyboardUpdate();
s3ePointerUpdate();

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_Marmalade_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_sdl_directx11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@ int main(int, char**)
}
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplDX11_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_sdl_metal/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@ int main(int, char**)
id <MTLRenderCommandEncoder> renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
[renderEncoder pushDebugGroup:@"ImGui demo"];

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplMetal_NewFrame(renderPassDescriptor);
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_sdl_opengl2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ int main(int, char**)
done = true;
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_sdl_opengl3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ int main(int, char**)
done = true;
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
7 changes: 5 additions & 2 deletions examples/example_sdl_vulkan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,17 @@ int main(int, char**)
}
}

if (io.Fonts->IsDirty())
UpdateFontsTexture(wd);
ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
if (io.Fonts->IsDirty())
UpdateFontsTexture(wd);
ImGui_ImplVulkan_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_win32_directx10/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ int main(int, char**)
continue;
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplDX10_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_win32_directx11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ int main(int, char**)
continue;
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
9 changes: 6 additions & 3 deletions examples/example_win32_directx12/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ int main(int, char**)
continue;
}

// Start the Dear ImGui frame
ImGui_ImplDX12_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::UpdateFontDemo();

// Upload Fonts
if (io.Fonts->IsDirty())
Expand All @@ -146,8 +144,13 @@ int main(int, char**)
ImGui_ImplDX12_UpdateFontsTexture();
}

// Start the Dear ImGui frame
ImGui_ImplDX12_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
4 changes: 4 additions & 0 deletions examples/example_win32_directx9/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ int main(int, char**)
continue;
}

ImGui::UpdateFontDemo();

// Start the Dear ImGui frame
ImGui_ImplDX9_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

ImGui::ShowFontDemoWindow();

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
Expand Down
3 changes: 3 additions & 0 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ namespace ImGui
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)

IMGUI_API void UpdateFontDemo();
IMGUI_API void ShowFontDemoWindow();

// Styles
IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); // new, recommended style (default)
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font
Expand Down
Loading

0 comments on commit a3415c9

Please sign in to comment.