C++ Imgui win32_directx9 background color

Its just dont changing background (still black) Aslo i cant find a good documentation about imgui, is it exist? I am using example dx9 from official imgui github My code = (also i tried put PushStyleColor inside tab) Background must be changed =

I tried ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.39f, 0.00f, 0.63f, 0.11f));

1

2 Answers

ImGui will handle coloring its elements like windows, widgets, menus, etc, via styling as you are doing. But if you want to change the color of the background (behind any ImGui elements), you need to do it yourself. In the example code there's a line which clears the DX surface to a solid color: you can change this to whatever suits your needs.

Here is the snippet:

 // Rendering ImGui::EndFrame(); 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_color.x*clear_color.w*255.0f), (int)(clear_color.y*clear_color.w*255.0f), (int)(clear_color.z*clear_color.w*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)

From

ImGuiStyle& style = ImGui::GetStyle();
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.39f, 0.00f, 0.63f, 0.11f);
style.WindowRounding = 0.25;

helped me set it above main while loop

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like