From 30a7ec6fd6f1fe4cf14f45f5c745ef9fc2c46523 Mon Sep 17 00:00:00 2001 From: SlowRiot Date: Thu, 3 Sep 2026 14:40:16 +0100 Subject: [PATCH] Examples: Emscripten+WebGPU: Align demo window with other examples --- examples/example_emscripten_wgpu/main.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/example_emscripten_wgpu/main.cpp b/examples/example_emscripten_wgpu/main.cpp index c30a03211..41d47b85d 100644 --- a/examples/example_emscripten_wgpu/main.cpp +++ b/examples/example_emscripten_wgpu/main.cpp @@ -162,17 +162,17 @@ int main(int, char**) static float f = 0.0f; static int counter = 0; - ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. + ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. - ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) - ImGui::Text("Platform backend: imgui_impl_emscripten"); - ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state + ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) + ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 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 + 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::Button("Button")) ++counter; // Buttons return true when clicked (most widgets return true when edited/activated) + if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) + counter++; ImGui::SameLine(); ImGui::Text("counter = %d", counter); @@ -183,9 +183,10 @@ int main(int, char**) // 3. Show another simple window. if (show_another_window) { - ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) + ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) ImGui::Text("Hello from another window!"); - if (ImGui::Button("Close Me")) show_another_window = false; + if (ImGui::Button("Close Me")) + show_another_window = false; ImGui::End(); }