Skip to content

Commit

Permalink
Fix updating clear color on sdl
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryO committed Sep 4, 2020
1 parent d824db2 commit e8001e1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion examples/example_sdl_vulkan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ int main(int, char**)
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
wd->ClearValue.color.float32[0] = clear_color.x;
wd->ClearValue.color.float32[1] = clear_color.y;
wd->ClearValue.color.float32[2] = clear_color.z;
wd->ClearValue.color.float32[3] = clear_color.w;

// Main loop
bool done = false;
Expand Down Expand Up @@ -496,7 +500,13 @@ int main(int, char**)
ImGui::Checkbox("Another Window", &show_another_window);

ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
if(ImGui::ColorEdit3("clear color", (float*)&clear_color)) // Edit 3 floats representing a color
{
wd->ClearValue.color.float32[0] = clear_color.x;
wd->ClearValue.color.float32[1] = clear_color.y;
wd->ClearValue.color.float32[2] = clear_color.z;
wd->ClearValue.color.float32[3] = clear_color.w;
}

if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
Expand Down

0 comments on commit e8001e1

Please sign in to comment.