Examples: Using Dark theme by default. (#707). Tweaked demo code.

docking
omar 7 years ago
parent 596b6d6de2
commit cca9c3e3da

@ -26,8 +26,8 @@ int main(int, char**)
ImGui_ImplA5_Init(display); ImGui_ImplA5_Init(display);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -76,25 +76,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -123,8 +123,8 @@ int main(int, char**)
ImGui_ImplDX10_Init(hwnd, g_pd3dDevice); ImGui_ImplDX10_Init(hwnd, g_pd3dDevice);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -167,25 +167,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -126,8 +126,8 @@ int main(int, char**)
ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext); ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -170,25 +170,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -78,8 +78,8 @@ int main(int, char**)
ImGui_ImplDX9_Init(hwnd, g_pd3dDevice); ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -124,25 +124,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -18,8 +18,8 @@ int main(int, char**)
ImGui_Marmalade_Init(true); ImGui_Marmalade_Init(true);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -59,25 +59,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -30,8 +30,8 @@ int main(int, char**)
ImGui_ImplGlfwGL2_Init(window, true); ImGui_ImplGlfwGL2_Init(window, true);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -67,25 +67,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -35,8 +35,8 @@ int main(int, char**)
ImGui_ImplGlfwGL3_Init(window, true); ImGui_ImplGlfwGL3_Init(window, true);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -72,25 +72,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -36,8 +36,8 @@ int main(int, char**)
ImGui_ImplSdlGL2_Init(window); ImGui_ImplSdlGL2_Init(window);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -76,29 +76,37 @@ 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 automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -36,8 +36,8 @@ int main(int, char**)
ImGui_ImplSdlGL3_Init(window); ImGui_ImplSdlGL3_Init(window);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -80,25 +80,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -625,8 +625,8 @@ int main(int, char**)
ImGui_ImplGlfwVulkan_Init(window, true, &init_data); ImGui_ImplGlfwVulkan_Init(window, true, &init_data);
// Setup style // Setup style
ImGui::StyleColorsClassic(); ImGui::StyleColorsDark();
//ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic();
// 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.
@ -700,25 +700,33 @@ int main(int, char**)
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window 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!"); // Some text (you can use a format string too) static int counter = 0;
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well. ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
show_demo_window ^= 1;
if (ImGui::Button("Another Window")) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
show_another_window ^= 1; ImGui::Checkbox("Another Window", &show_another_window);
if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
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);
} }
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name the window. // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (show_another_window) if (show_another_window)
{ {
ImGui::Begin("Another Window", &show_another_window); ImGui::Begin("Another Window", &show_another_window);
ImGui::Text("Hello from another window!"); ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End(); ImGui::End();
} }
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window) if (show_demo_window)
{ {
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::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!

@ -1979,7 +1979,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
// 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. // 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 = -1;
if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0")) if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0"))
{ {
switch (style_idx) switch (style_idx)

Loading…
Cancel
Save