Examples: Comments, synched some minor drift between examples + stronger suggestion to use StyleColorsDark().

docking
omar 7 years ago
parent 1b86e7343f
commit ce13426a1a

@ -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.
@ -69,15 +73,17 @@ 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("Demo Window")) show_demo_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;
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f/ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 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);
} }
// 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 the window.
@ -91,7 +97,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -28,7 +28,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
{ {
if (hud->show_demo_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::ShowDemoWindow(&hud->show_demo_window ); ImGui::ShowDemoWindow(&hud->show_demo_window );
} }

@ -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.
@ -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("Demo Window")) show_demo_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,7 +191,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -188,7 +194,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -139,7 +145,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -40,26 +44,28 @@ int main(int, char**)
// Main loop // Main loop
while (true) while (true)
{ {
if (s3eDeviceCheckQuitRequest()) if (s3eDeviceCheckQuitRequest())
break; break;
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
s3eKeyboardUpdate(); s3eKeyboardUpdate();
s3ePointerUpdate(); s3ePointerUpdate();
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("Demo Window")) show_demo_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);
} }
@ -74,12 +80,12 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }
// Rendering // Rendering
IwGxSetColClear(clear_color.x*255,clear_color.y*255,clear_color.z*255,clear_color.w*255) ; IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
IwGxClear(); IwGxClear();
ImGui::Render(); ImGui::Render();
IwGxSwapBuffers(); IwGxSwapBuffers();

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -82,7 +88,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -87,7 +93,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -95,7 +101,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -95,7 +101,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

@ -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.
@ -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("Demo Window")) show_demo_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);
} }
@ -716,7 +722,7 @@ int main(int, char**)
// 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().
if (show_demo_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::ShowDemoWindow(&show_demo_window); ImGui::ShowDemoWindow(&show_demo_window);
} }

Loading…
Cancel
Save