From cb285c4d35757f39dd92137473419e42e5f6c145 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 16 Mar 2015 11:53:36 +0000 Subject: [PATCH] Examples: uses SetNextWindowPos/SetNextWindowSize when applicable --- examples/directx11_example/main.cpp | 3 ++- examples/directx9_example/main.cpp | 3 ++- examples/opengl3_example/main.cpp | 3 ++- examples/opengl_example/main.cpp | 3 ++- imgui.cpp | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index b051fd24..0064a93a 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -188,7 +188,8 @@ int main(int, char**) // 2. Show another simple window, this time using an explicit Begin/End pair if (show_another_window) { - ImGui::Begin("Another Window", &show_another_window, ImVec2(200,100)); + ImGui::SetNextWindowSize(ImVec2(200,100), ImGuiSetCond_FirstUseEver); + ImGui::Begin("Another Window", &show_another_window); ImGui::Text("Hello"); ImGui::End(); } diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp index 9a01ba31..ce8ca477 100644 --- a/examples/directx9_example/main.cpp +++ b/examples/directx9_example/main.cpp @@ -115,7 +115,8 @@ int main(int, char**) // 2. Show another simple window, this time using an explicit Begin/End pair if (show_another_window) { - ImGui::Begin("Another Window", &show_another_window, ImVec2(200,100)); + ImGui::SetNextWindowSize(ImVec2(200,100), ImGuiSetCond_FirstUseEver); + ImGui::Begin("Another Window", &show_another_window); ImGui::Text("Hello"); ImGui::End(); } diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp index dc88a7c6..9f0207aa 100644 --- a/examples/opengl3_example/main.cpp +++ b/examples/opengl3_example/main.cpp @@ -59,7 +59,8 @@ int main(int, char**) // 2. Show another simple window, this time using an explicit Begin/End pair if (show_another_window) { - ImGui::Begin("Another Window", &show_another_window, ImVec2(200,100)); + ImGui::SetNextWindowSize(ImVec2(200,100), ImGuiSetCond_FirstUseEver); + ImGui::Begin("Another Window", &show_another_window); ImGui::Text("Hello"); ImGui::End(); } diff --git a/examples/opengl_example/main.cpp b/examples/opengl_example/main.cpp index 471f9a29..92bf842c 100644 --- a/examples/opengl_example/main.cpp +++ b/examples/opengl_example/main.cpp @@ -53,7 +53,8 @@ int main(int, char**) // 2. Show another simple window, this time using an explicit Begin/End pair if (show_another_window) { - ImGui::Begin("Another Window", &show_another_window, ImVec2(200,100)); + ImGui::SetNextWindowSize(ImVec2(200,100), ImGuiSetCond_FirstUseEver); + ImGui::Begin("Another Window", &show_another_window); ImGui::Text("Hello"); ImGui::End(); } diff --git a/imgui.cpp b/imgui.cpp index b2c8d11c..715fb6ce 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9545,13 +9545,13 @@ static void ShowExampleAppAutoResize(bool* opened) static void ShowExampleAppFixedOverlay(bool* opened) { + ImGui::SetNextWindowPos(ImVec2(10,10)); if (!ImGui::Begin("Example: Fixed Overlay", opened, ImVec2(0,0), 0.3f, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoSavedSettings)) { ImGui::End(); return; } - ImGui::SetWindowPos(ImVec2(10,10)); ImGui::Text("Simple overlay\non the top-left side of the screen."); ImGui::Separator(); ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);