From 842e88a8e3dcbd775390732fe5a0c7f65a7b62a3 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 27 Sep 2017 15:47:08 +0200 Subject: [PATCH] Examples: Avoid using ImColor() to not tempt newcomers into looking at it --- examples/allegro5_example/main.cpp | 2 +- examples/directx10_example/main.cpp | 6 +++--- examples/directx11_example/main.cpp | 6 +++--- examples/directx9_example/main.cpp | 6 +++--- examples/marmalade_example/main.cpp | 2 +- examples/opengl2_example/main.cpp | 2 +- examples/opengl3_example/main.cpp | 2 +- examples/sdl_opengl2_example/main.cpp | 2 +- examples/sdl_opengl3_example/main.cpp | 2 +- examples/vulkan_example/main.cpp | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/allegro5_example/main.cpp b/examples/allegro5_example/main.cpp index 9f8a6c35..2b161d37 100644 --- a/examples/allegro5_example/main.cpp +++ b/examples/allegro5_example/main.cpp @@ -37,7 +37,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop bool running = true; diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp index 90add036..88472e5b 100644 --- a/examples/directx10_example/main.cpp +++ b/examples/directx10_example/main.cpp @@ -137,7 +137,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_col = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop MSG msg; @@ -158,7 +158,7 @@ int main(int, char**) static float f = 0.0f; ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); - ImGui::ColorEdit3("clear color", (float*)&clear_col); + ImGui::ColorEdit3("clear color", (float*)&clear_color); if (ImGui::Button("Test Window")) show_test_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); @@ -180,7 +180,7 @@ int main(int, char**) } // Rendering - g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_col); + g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color); ImGui::Render(); g_pSwapChain->Present(1, 0); // Present with vsync diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index 76bab951..ab563403 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -140,7 +140,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_col = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop MSG msg; @@ -161,7 +161,7 @@ int main(int, char**) static float f = 0.0f; ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); - ImGui::ColorEdit3("clear color", (float*)&clear_col); + ImGui::ColorEdit3("clear color", (float*)&clear_color); if (ImGui::Button("Test Window")) show_test_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); @@ -183,7 +183,7 @@ int main(int, char**) } // Rendering - g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_col); + g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color); ImGui::Render(); g_pSwapChain->Present(1, 0); // Present with vsync diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp index f9791b73..85f34eee 100644 --- a/examples/directx9_example/main.cpp +++ b/examples/directx9_example/main.cpp @@ -89,7 +89,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_col = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop MSG msg; @@ -112,7 +112,7 @@ int main(int, char**) static float f = 0.0f; ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); - ImGui::ColorEdit3("clear color", (float*)&clear_col); + ImGui::ColorEdit3("clear color", (float*)&clear_color); if (ImGui::Button("Test Window")) show_test_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); @@ -137,7 +137,7 @@ int main(int, char**) g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, false); g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false); g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, false); - D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_col.x*255.0f), (int)(clear_col.y*255.0f), (int)(clear_col.z*255.0f), (int)(clear_col.w*255.0f)); + D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_color.x*255.0f), (int)(clear_color.y*255.0f), (int)(clear_color.z*255.0f), (int)(clear_color.w*255.0f)); g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_col_dx, 1.0f, 0); if (g_pd3dDevice->BeginScene() >= 0) { diff --git a/examples/marmalade_example/main.cpp b/examples/marmalade_example/main.cpp index 57b7f0b6..ebc812f1 100644 --- a/examples/marmalade_example/main.cpp +++ b/examples/marmalade_example/main.cpp @@ -29,7 +29,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop while (true) diff --git a/examples/opengl2_example/main.cpp b/examples/opengl2_example/main.cpp index 5674a4bc..c676953f 100644 --- a/examples/opengl2_example/main.cpp +++ b/examples/opengl2_example/main.cpp @@ -36,7 +36,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop while (!glfwWindowShouldClose(window)) diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp index 0de9b0a0..d3ac2cc2 100644 --- a/examples/opengl3_example/main.cpp +++ b/examples/opengl3_example/main.cpp @@ -44,7 +44,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop while (!glfwWindowShouldClose(window)) diff --git a/examples/sdl_opengl2_example/main.cpp b/examples/sdl_opengl2_example/main.cpp index 4db6f0f9..fb5f3fb5 100644 --- a/examples/sdl_opengl2_example/main.cpp +++ b/examples/sdl_opengl2_example/main.cpp @@ -42,7 +42,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop bool done = false; diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/sdl_opengl3_example/main.cpp index 30b14e72..19e3f861 100644 --- a/examples/sdl_opengl3_example/main.cpp +++ b/examples/sdl_opengl3_example/main.cpp @@ -45,7 +45,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop bool done = false; diff --git a/examples/vulkan_example/main.cpp b/examples/vulkan_example/main.cpp index 7ed9ea12..64c0f08c 100644 --- a/examples/vulkan_example/main.cpp +++ b/examples/vulkan_example/main.cpp @@ -664,7 +664,7 @@ int main(int, char**) bool show_test_window = true; bool show_another_window = false; - ImVec4 clear_color = ImColor(114, 144, 154); + ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // When IMGUI_UNLIMITED_FRAME_RATE is defined we render into latest image acquired from the swapchain but we display the image which was rendered before. // Hence we must render once and increase the g_FrameIndex without presenting, which we do before entering the render loop.