Merge branch 'master' into navigation

# Conflicts:
#	imgui.cpp
This commit is contained in:
omar 2017-12-24 18:59:40 +01:00
commit de5c304b49
19 changed files with 227 additions and 161 deletions

View File

@ -140,7 +140,7 @@ Frequently Asked Question (FAQ)
<b>Where is the documentation?</b> <b>Where is the documentation?</b>
- The documentation is at the top of imgui.cpp + effectively imgui.h. - The documentation is at the top of imgui.cpp + effectively imgui.h.
- Example code is in imgui_demo.cpp and particularly the ImGui::ShowTestWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output. - Example code is in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output.
- Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder. - Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder.
- We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort. - We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.

View File

@ -25,6 +25,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplA5_Init(display); ImGui_ImplA5_Init(display);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -41,7 +45,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -69,14 +73,16 @@ int main(int, char**)
ImGui_ImplA5_NewFrame(); ImGui_ImplA5_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -88,11 +94,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -9,7 +9,7 @@
void DebugHUD_InitDefaults( DebugHUD *hud ) void DebugHUD_InitDefaults( DebugHUD *hud )
{ {
hud->show_test_window = true; hud->show_demo_window = true;
hud->show_example_window = true; hud->show_example_window = true;
hud->rotation_speed = 15.0f; hud->rotation_speed = 15.0f;
@ -26,10 +26,10 @@ void DebugHUD_InitDefaults( DebugHUD *hud )
void DebugHUD_DoInterface(DebugHUD *hud) void DebugHUD_DoInterface(DebugHUD *hud)
{ {
if (hud->show_test_window) if (hud->show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&hud->show_test_window ); ImGui::ShowDemoWindow(&hud->show_demo_window );
} }
if (hud->show_example_window) if (hud->show_example_window)

View File

@ -6,7 +6,7 @@
typedef struct DebugHUD typedef struct DebugHUD
{ {
bool show_test_window; bool show_demo_window;
bool show_example_window; bool show_example_window;
float rotation_speed; float rotation_speed;
float cubeColor1[4]; float cubeColor1[4];

View File

@ -125,6 +125,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplDX10_Init(hwnd, g_pd3dDevice); ImGui_ImplDX10_Init(hwnd, g_pd3dDevice);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -141,7 +145,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -163,14 +167,16 @@ int main(int, char**)
ImGui_ImplDX10_NewFrame(); ImGui_ImplDX10_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -182,11 +188,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -128,6 +128,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext); ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -144,7 +148,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -166,14 +170,16 @@ int main(int, char**)
ImGui_ImplDX11_NewFrame(); ImGui_ImplDX11_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -185,11 +191,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -77,6 +77,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplDX9_Init(hwnd, g_pd3dDevice); ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -93,7 +97,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -117,14 +121,16 @@ int main(int, char**)
ImGui_ImplDX9_NewFrame(); ImGui_ImplDX9_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -136,11 +142,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -17,6 +17,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_Marmalade_Init(true); ImGui_Marmalade_Init(true);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -33,7 +37,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -52,14 +56,16 @@ int main(int, char**)
ImGui_Marmalade_NewFrame(); ImGui_Marmalade_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -71,11 +77,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -22,7 +22,7 @@ int main(int, char**)
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!");
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
ImGui::ShowTestWindow(NULL); ImGui::ShowDemoWindow(NULL);
ImGui::Render(); ImGui::Render();
} }

View File

@ -29,6 +29,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplGlfwGL2_Init(window, true); ImGui_ImplGlfwGL2_Init(window, true);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -45,7 +49,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -60,14 +64,16 @@ int main(int, char**)
ImGui_ImplGlfwGL2_NewFrame(); ImGui_ImplGlfwGL2_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -79,11 +85,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -34,6 +34,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplGlfwGL3_Init(window, true); ImGui_ImplGlfwGL3_Init(window, true);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -50,7 +54,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -65,14 +69,16 @@ int main(int, char**)
ImGui_ImplGlfwGL3_NewFrame(); ImGui_ImplGlfwGL3_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -84,11 +90,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -35,6 +35,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplSdlGL2_Init(window); ImGui_ImplSdlGL2_Init(window);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -51,7 +55,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -73,14 +77,16 @@ int main(int, char**)
ImGui_ImplSdlGL2_NewFrame(window); ImGui_ImplSdlGL2_NewFrame(window);
// 1. Show a simple window // 1. Show a simple window
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -92,11 +98,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -35,6 +35,10 @@ int main(int, char**)
// Setup ImGui binding // Setup ImGui binding
ImGui_ImplSdlGL3_Init(window); ImGui_ImplSdlGL3_Init(window);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -51,7 +55,7 @@ int main(int, char**)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL); //IM_ASSERT(font != NULL);
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -73,14 +77,16 @@ int main(int, char**)
ImGui_ImplSdlGL3_NewFrame(window); ImGui_ImplSdlGL3_NewFrame(window);
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -92,11 +98,11 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering

View File

@ -625,6 +625,10 @@ int main(int, char**)
init_data.check_vk_result = check_vk_result; init_data.check_vk_result = check_vk_result;
ImGui_ImplGlfwVulkan_Init(window, true, &init_data); ImGui_ImplGlfwVulkan_Init(window, true, &init_data);
// Setup style
ImGui::StyleColorsClassic();
//ImGui::StyleColorsDark();
// Load Fonts // Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
@ -668,7 +672,7 @@ int main(int, char**)
ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects(); ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects();
} }
bool show_test_window = true; bool show_demo_window = true;
bool show_another_window = false; bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
@ -694,14 +698,16 @@ int main(int, char**)
ImGui_ImplGlfwVulkan_NewFrame(); ImGui_ImplGlfwVulkan_NewFrame();
// 1. Show a simple window. // 1. Show a simple window.
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug". // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
{ {
static float f = 0.0f; static float f = 0.0f;
ImGui::Text("Hello, world!"); ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
if (ImGui::Button("Test Window")) show_test_window ^= 1; if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
if (ImGui::Button("Another Window")) show_another_window ^= 1; show_demo_window ^= 1;
if (ImGui::Button("Another Window"))
show_another_window ^= 1;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
} }
@ -713,18 +719,14 @@ int main(int, char**)
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
if (show_test_window) if (show_demo_window)
{ {
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::ShowTestWindow(&show_test_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
g_ClearValue.color.float32[0] = clear_color.x; memcpy(&g_ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
g_ClearValue.color.float32[1] = clear_color.y;
g_ClearValue.color.float32[2] = clear_color.z;
g_ClearValue.color.float32[3] = clear_color.w;
frame_begin(); frame_begin();
ImGui_ImplGlfwVulkan_Render(g_CommandBuffer[g_FrameIndex]); ImGui_ImplGlfwVulkan_Render(g_CommandBuffer[g_FrameIndex]);
frame_end(); frame_end();

View File

@ -23,9 +23,9 @@
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
//---- Don't implement test window functionality (ShowTestWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
//---- It is very strongly recommended to NOT disable the test windows. Please read the comment at the top of imgui_demo.cpp to learn why. //---- It is very strongly recommended to NOT disable the demo windows. Please read the comment at the top of imgui_demo.cpp to learn why.
//#define IMGUI_DISABLE_TEST_WINDOWS //#define IMGUI_DISABLE_DEMO_WINDOWS
//---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself. //---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself.
//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS

View File

@ -4,14 +4,14 @@
// ** EXPERIMENTAL GAMEPAD/KEYBOARD NAVIGATION BRANCH // ** EXPERIMENTAL GAMEPAD/KEYBOARD NAVIGATION BRANCH
// ** Grep for FIXME-NAVIGATION // ** Grep for FIXME-NAVIGATION
// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code. // Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
// Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase. // Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase.
// Get latest version at https://github.com/ocornut/imgui // Get latest version at https://github.com/ocornut/imgui
// Releases change-log at https://github.com/ocornut/imgui/releases // Releases change-log at https://github.com/ocornut/imgui/releases
// Gallery (please post your screenshots/video there!): https://github.com/ocornut/imgui/issues/1269 // Gallery (please post your screenshots/video there!): https://github.com/ocornut/imgui/issues/1269
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub. // Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
// This library is free but I need your support to sustain development and maintenance. // This library is free but I need your support to sustain development and maintenance.
// If you work for a company, please consider financial support, e.g: https://www.patreon.com/imgui // If you work for a company, please consider financial support, see Readme. For individuals: https://www.patreon.com/imgui
/* /*
@ -91,7 +91,7 @@
- Read the FAQ below this section! - Read the FAQ below this section!
- Your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention - Your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention
on your side, no state duplication, less sync, less bugs. on your side, no state duplication, less sync, less bugs.
- Call and read ImGui::ShowTestWindow() for demo code demonstrating most features. - Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features.
- You can learn about immediate-mode gui principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861 - You can learn about immediate-mode gui principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861
HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI
@ -249,8 +249,9 @@
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
Also read releases logs https://github.com/ocornut/imgui/releases for more details. Also read releases logs https://github.com/ocornut/imgui/releases for more details.
- 2017/12/21 (1.53) - renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags - 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete).
- 2017/12/21 (1.53) - removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags. - 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags
- 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame.
- 2017/12/14 (1.53) - using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. - 2017/12/14 (1.53) - using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set.
- 2017/12/13 (1.53) - renamed GetItemsLineHeightWithSpacing() to GetFrameHeightWithSpacing(). Kept redirection function (will obsolete). - 2017/12/13 (1.53) - renamed GetItemsLineHeightWithSpacing() to GetFrameHeightWithSpacing(). Kept redirection function (will obsolete).
- 2017/12/13 (1.53) - obsoleted IsRootWindowFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootWindow). Kept redirection function (will obsolete). - 2017/12/13 (1.53) - obsoleted IsRootWindowFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootWindow). Kept redirection function (will obsolete).
@ -612,7 +613,7 @@
- tip: the ImGuiOnceUponAFrame helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle - tip: the ImGuiOnceUponAFrame helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle
of a deep nested inner loop in your code. of a deep nested inner loop in your code.
- tip: you can call Render() multiple times (e.g for VR renders). - tip: you can call Render() multiple times (e.g for VR renders).
- tip: call and read the ShowTestWindow() code in imgui_demo.cpp for more example of how to use ImGui! - tip: call and read the ShowDemoWindow() code in imgui_demo.cpp for more example of how to use ImGui!
*/ */

View File

@ -2,7 +2,7 @@
// (headers) // (headers)
// See imgui.cpp file for documentation. // See imgui.cpp file for documentation.
// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code. // Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
// Read 'Programmer guide' in imgui.cpp for notes on how to setup ImGui in your codebase. // Read 'Programmer guide' in imgui.cpp for notes on how to setup ImGui in your codebase.
// Get latest version at https://github.com/ocornut/imgui // Get latest version at https://github.com/ocornut/imgui
@ -138,7 +138,7 @@ namespace ImGui
IMGUI_API void Shutdown(); IMGUI_API void Shutdown();
// Demo, Debug, Informations // Demo, Debug, Informations
IMGUI_API void ShowTestWindow(bool* p_open = NULL); // create demo/test window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics window. display ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc. IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics window. display ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc.
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
IMGUI_API bool ShowStyleSelector(const char* label); IMGUI_API bool ShowStyleSelector(const char* label);
@ -1028,6 +1028,7 @@ struct ImGuiIO
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
namespace ImGui namespace ImGui
{ {
static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETE 1.53+
static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETE 1.53+ static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETE 1.53+
static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETE 1.53+ static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETE 1.53+
static inline void SetNextWindowContentWidth(float width) { SetNextWindowContentSize(ImVec2(width, 0.0f)); } // OBSOLETE 1.53+ (nb: original version preserved last Y value set by SetNextWindowContentSize()) static inline void SetNextWindowContentWidth(float width) { SetNextWindowContentSize(ImVec2(width, 0.0f)); } // OBSOLETE 1.53+ (nb: original version preserved last Y value set by SetNextWindowContentSize())

View File

@ -3,20 +3,20 @@
// Message to the person tempted to delete this file when integrating ImGui into their code base: // Message to the person tempted to delete this file when integrating ImGui into their code base:
// Don't do it! Do NOT remove this file from your project! It is useful reference code that you and other users will want to refer to. // Don't do it! Do NOT remove this file from your project! It is useful reference code that you and other users will want to refer to.
// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowTestWindow(). // Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow().
// During development, you can call ImGui::ShowTestWindow() in your code to learn about various features of ImGui. Have it wired in a debug menu! // During development, you can call ImGui::ShowDemoWindow() in your code to learn about various features of ImGui. Have it wired in a debug menu!
// Removing this file from your project is hindering access to documentation for everyone in your team, likely leading you to poorer usage of the library. // Removing this file from your project is hindering access to documentation for everyone in your team, likely leading you to poorer usage of the library.
// Note that you can #define IMGUI_DISABLE_TEST_WINDOWS in imconfig.h for the same effect. // Note that you can #define IMGUI_DISABLE_DEMO_WINDOWS in imconfig.h for the same effect.
// If you want to link core ImGui in your public builds but not those test windows, #define IMGUI_DISABLE_TEST_WINDOWS in imconfig.h and those functions will be empty. // If you want to link core ImGui in your final builds but not those demo windows, #define IMGUI_DISABLE_DEMO_WINDOWS in imconfig.h and those functions will be empty.
// For any other case, if you have ImGui available you probably want this to be available for reference and execution. // In other situation, when you have ImGui available you probably want this to be available for reference and execution.
// Thank you, // Thank you,
// -Your beloved friend, imgui_demo.cpp (that you won't delete) // -Your beloved friend, imgui_demo.cpp (that you won't delete)
// Message to beginner C/C++ programmer about the meaning of 'static': in this demo code, we frequently we use 'static' variables inside functions. // Message to beginner C/C++ programmers. About the meaning of 'static': in this demo code, we frequently we use 'static' variables inside functions.
// We do this as a way to gather code and data in the same place, make the demo code faster to read, faster to write, and smaller. A static variable persist across calls, // We do this as a way to gather code and data in the same place, just to make the demo code faster to read, faster to write, and use less code.
// so it is essentially like a global variable but declared inside the scope of the function. // A static variable persist across calls, so it is essentially like a global variable but declared inside the scope of the function.
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant or used in threads. // It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant or used in threads.
// This may be a pattern you want to use in your code (simple is beautiful!), but most of the real data you would be editing is likely to be stored outside your function. // This might be a pattern you occasionally want to use in your code, but most of the real data you would be editing is likely to be stored outside your function.
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
@ -52,25 +52,28 @@
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
#if (__GNUC__ >= 6) #if (__GNUC__ >= 6)
#pragma GCC diagnostic ignored "-Wmisleading-indentation" // warning: this 'if' clause does not guard this statement // GCC 6.0+ only. See #883 on github. #pragma GCC diagnostic ignored "-Wmisleading-indentation" // warning: this 'if' clause does not guard this statement // GCC 6.0+ only. See #883 on GitHub.
#endif #endif
#endif #endif
// Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \n. // Play it nice with Windows users. Notepad in 2017 still doesn't display text data with Unix-style \n.
#ifdef _WIN32 #ifdef _WIN32
#define IM_NEWLINE "\r\n" #define IM_NEWLINE "\r\n"
#else #else
#define IM_NEWLINE "\n" #define IM_NEWLINE "\n"
#endif #endif
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
#define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B)) #define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B))
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// DEMO CODE // DEMO CODE
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef IMGUI_DISABLE_TEST_WINDOWS #if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && defined(IMGUI_DISABLE_TEST_WINDOWS) && !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Obsolete name since 1.53, TEST->DEMO
#define IMGUI_DISABLE_DEMO_WINDOWS
#endif
#if !defined(IMGUI_DISABLE_DEMO_WINDOWS)
static void ShowExampleAppConsole(bool* p_open); static void ShowExampleAppConsole(bool* p_open);
static void ShowExampleAppLog(bool* p_open); static void ShowExampleAppLog(bool* p_open);
@ -121,7 +124,7 @@ void ImGui::ShowUserGuide()
} }
// Demonstrate most ImGui features (big function!) // Demonstrate most ImGui features (big function!)
void ImGui::ShowTestWindow(bool* p_open) void ImGui::ShowDemoWindow(bool* p_open)
{ {
// Examples apps // Examples apps
static bool show_app_main_menu_bar = false; static bool show_app_main_menu_bar = false;
@ -233,7 +236,7 @@ void ImGui::ShowTestWindow(bool* p_open)
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::CollapsingHeader("Help")) if (ImGui::CollapsingHeader("Help"))
{ {
ImGui::TextWrapped("This window is being created by the ShowTestWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n"); ImGui::TextWrapped("This window is being created by the ShowDemoWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n");
ImGui::Text("USER GUIDE:"); ImGui::Text("USER GUIDE:");
ImGui::ShowUserGuide(); ImGui::ShowUserGuide();
} }
@ -1949,6 +1952,8 @@ void ImGui::ShowTestWindow(bool* p_open)
ImGui::End(); ImGui::End();
} }
// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.
// Here we use the simplified Combo() api that packs items into a single literal string. Useful for quick combo boxes where the choices are known locally.
bool ImGui::ShowStyleSelector(const char* label) bool ImGui::ShowStyleSelector(const char* label)
{ {
static int style_idx = 0; static int style_idx = 0;
@ -1965,6 +1970,8 @@ bool ImGui::ShowStyleSelector(const char* label)
return false; return false;
} }
// Demo helper function to select among loaded fonts.
// Here we use the regular BeginCombo()/EndCombo() api which is more the more flexible one.
void ImGui::ShowFontSelector(const char* label) void ImGui::ShowFontSelector(const char* label)
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
@ -3078,7 +3085,7 @@ static void ShowExampleAppLongText(bool* p_open)
// End of Demo code // End of Demo code
#else #else
void ImGui::ShowTestWindow(bool*) {} void ImGui::ShowDemoWindow(bool*) {}
void ImGui::ShowUserGuide() {} void ImGui::ShowUserGuide() {}
void ImGui::ShowStyleEditor(ImGuiStyle*) {} void ImGui::ShowStyleEditor(ImGuiStyle*) {}

View File

@ -229,6 +229,7 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst)
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.12f); colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.12f);
} }
// Those light colors are better suited with a thicker font than the default one + FrameBorder
void ImGui::StyleColorsLight(ImGuiStyle* dst) void ImGui::StyleColorsLight(ImGuiStyle* dst)
{ {
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();