From 6201cad2b4c34830c9da17833b359ee40ffcd1c6 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 9 Jul 2018 11:32:20 +0200 Subject: [PATCH] Examples: Comments, Demo: Log early out, TODO. (#1553) --- TODO.txt | 7 +++++-- examples/example_glfw_opengl3/main.cpp | 8 ++++++-- examples/example_sdl_opengl3/main.cpp | 7 +++++-- examples/imgui_impl_opengl3.cpp | 5 ++++- imgui_demo.cpp | 8 ++++++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/TODO.txt b/TODO.txt index 513341ec0361..175687d4c014 100644 --- a/TODO.txt +++ b/TODO.txt @@ -17,7 +17,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - window: background options for child windows, border option (disable rounding). - window: resizing from any sides? done. > need backends to honor mouse cursors properly. (#822) - window: resize from borders: support some form of outer padding to make it easier to grab borders. (#822) - - window: begin with *p_open == false should return false. + - window: fix resize glitch when collapsing an AlwaysAutoResize window. + - window: begin with *p_open == false could return false. - window: get size/pos helpers given names (see discussion in #249) - window: a collapsed window can be stuck behind the main menu bar? - window: when window is very small, prioritize resize button over close button. @@ -28,7 +29,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call. - window: GetWindowSize() returns (0,0) when not calculated? (#1045) - window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate. -!- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet. + - window: investigate better auto-positioning for new windows. + - scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet. - scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro) - drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded rendering. @@ -218,6 +220,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - drag and drop: add demo. (#143, #479) - drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov - drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637) + - drag and drop: make it easier and provide a demo to have tooltip both are source and target site, with a more detailed one on target site (tooltip ordering problem) - drag and drop: test with reordering nodes (in a list, or a tree node). (#143) - drag and drop: test integrating with os drag and drop. - drag and drop: make payload optional? (#143) diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp index 3cd6608d315b..b2dc54337a32 100644 --- a/examples/example_glfw_opengl3/main.cpp +++ b/examples/example_glfw_opengl3/main.cpp @@ -7,9 +7,13 @@ #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" #include -#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc. + +#include // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc. //#include -#include +//#include +//#include + +#include // Include glfw3.h after our OpenGL definitions static void glfw_error_callback(int error, const char* description) { diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp index ac20643f6288..798849d79441 100644 --- a/examples/example_sdl_opengl3/main.cpp +++ b/examples/example_sdl_opengl3/main.cpp @@ -7,10 +7,13 @@ #include "imgui_impl_sdl.h" #include "imgui_impl_opengl3.h" #include -#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc. -//#include #include +#include // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc. +//#include +//#include +//#include + int main(int, char**) { // Setup SDL diff --git a/examples/imgui_impl_opengl3.cpp b/examples/imgui_impl_opengl3.cpp index 73c614775f12..9029ae5d25b1 100644 --- a/examples/imgui_impl_opengl3.cpp +++ b/examples/imgui_impl_opengl3.cpp @@ -31,8 +31,11 @@ #include "imgui.h" #include "imgui_impl_opengl3.h" -#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc. + +#include // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc. //#include +//#include +//#include // OpenGL Data static char g_GlslVersion[32] = ""; diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 8cf6fd7e6f45..99d6ab1489de 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2905,7 +2905,7 @@ struct ExampleAppConsole // Here we create a context menu only available from the title bar. if (ImGui::BeginPopupContextItem()) { - if (ImGui::MenuItem("Close")) + if (ImGui::MenuItem("Close Console")) *p_open = false; ImGui::EndPopup(); } @@ -3172,7 +3172,11 @@ struct ExampleAppLog void Draw(const char* title, bool* p_open = NULL) { ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver); - ImGui::Begin(title, p_open); + if (!ImGui::Begin(title, p_open)) + { + ImGui::End(); + return; + } if (ImGui::Button("Clear")) Clear(); ImGui::SameLine(); bool copy = ImGui::Button("Copy");