mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	This commit is contained in:
		| @@ -23,7 +23,7 @@ or view this file with any Markdown viewer. | |||||||
| | [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) | | | [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) | | ||||||
| | [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) | | | [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) | | ||||||
| | **Q&A: Usage** | | | **Q&A: Usage** | | ||||||
| | **[About the ID Stack system..<br>Why is my widget not reacting when I click on it?<br>How can I have widgets with an empty label?<br>How can I have multiple widgets with the same label?](#q-about-the-id-stack-system)** | | | **[About the ID Stack system..<br>Why is my widget not reacting when I click on it?<br>How can I have widgets with an empty label?<br>How can I have multiple widgets with the same label?]<br>How can I have multiple windows with the same label?](#q-about-the-id-stack-system)** | | ||||||
| | [How can I display an image? What is ImTextureID, how does it work?](#q-how-can-i-display-an-image-what-is-imtextureid-how-does-it-work)| | | [How can I display an image? What is ImTextureID, how does it work?](#q-how-can-i-display-an-image-what-is-imtextureid-how-does-it-work)| | ||||||
| | [How can I use my own math types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-math-types-instead-of-imvec2imvec4) | | | [How can I use my own math types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-math-types-instead-of-imvec2imvec4) | | ||||||
| | [How can I interact with standard C++ types (such as std::string and std::vector)?](#q-how-can-i-interact-with-standard-c-types-such-as-stdstring-and-stdvector) | | | [How can I interact with standard C++ types (such as std::string and std::vector)?](#q-how-can-i-interact-with-standard-c-types-such-as-stdstring-and-stdvector) | | ||||||
| @@ -190,6 +190,7 @@ Refer to rendering backends in the [examples/](https://github.com/ocornut/imgui/ | |||||||
| ### Q: Why is my widget not reacting when I click on it? | ### Q: Why is my widget not reacting when I click on it? | ||||||
| ### Q: How can I have widgets with an empty label? | ### Q: How can I have widgets with an empty label? | ||||||
| ### Q: How can I have multiple widgets with the same label? | ### Q: How can I have multiple widgets with the same label? | ||||||
|  | ### Q: How can I have multiple windows with the same label? | ||||||
|  |  | ||||||
| A primer on labels and the ID Stack... | A primer on labels and the ID Stack... | ||||||
|  |  | ||||||
|   | |||||||
| @@ -723,9 +723,11 @@ CODE | |||||||
|  Q&A: Usage |  Q&A: Usage | ||||||
|  ---------- |  ---------- | ||||||
|  |  | ||||||
|  Q: Why is my widget not reacting when I click on it? |  Q: About the ID Stack system.. | ||||||
|  Q: How can I have widgets with an empty label? |    - Why is my widget not reacting when I click on it? | ||||||
|  Q: How can I have multiple widgets with the same label? |    - How can I have widgets with an empty label? | ||||||
|  |    - How can I have multiple widgets with the same label? | ||||||
|  |    - How can I have multiple windows with the same label? | ||||||
|  Q: How can I display an image? What is ImTextureID, how does it works? |  Q: How can I display an image? What is ImTextureID, how does it works? | ||||||
|  Q: How can I use my own math types instead of ImVec2/ImVec4? |  Q: How can I use my own math types instead of ImVec2/ImVec4? | ||||||
|  Q: How can I interact with standard C++ types (such as std::string and std::vector)? |  Q: How can I interact with standard C++ types (such as std::string and std::vector)? | ||||||
|   | |||||||
| @@ -786,6 +786,7 @@ static void ShowDemoWindowWidgets() | |||||||
|             for (int i = 0; i < 6; i++) |             for (int i = 0; i < 6; i++) | ||||||
|             { |             { | ||||||
|                 // Disable the default "open on single-click behavior" + set Selected flag according to our selection. |                 // Disable the default "open on single-click behavior" + set Selected flag according to our selection. | ||||||
|  |                 // To alter selection we use IsItemClicked() && !IsItemToggledOpen(), so clicking on an arrow doesn't alter selection. | ||||||
|                 ImGuiTreeNodeFlags node_flags = base_flags; |                 ImGuiTreeNodeFlags node_flags = base_flags; | ||||||
|                 const bool is_selected = (selection_mask & (1 << i)) != 0; |                 const bool is_selected = (selection_mask & (1 << i)) != 0; | ||||||
|                 if (is_selected) |                 if (is_selected) | ||||||
| @@ -794,7 +795,7 @@ static void ShowDemoWindowWidgets() | |||||||
|                 { |                 { | ||||||
|                     // Items 0..2 are Tree Node |                     // Items 0..2 are Tree Node | ||||||
|                     bool node_open = ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Node %d", i); |                     bool node_open = ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Node %d", i); | ||||||
|                     if (ImGui::IsItemClicked()) |                     if (ImGui::IsItemClicked() && !ImGui::IsItemToggledOpen()) | ||||||
|                         node_clicked = i; |                         node_clicked = i; | ||||||
|                     if (test_drag_and_drop && ImGui::BeginDragDropSource()) |                     if (test_drag_and_drop && ImGui::BeginDragDropSource()) | ||||||
|                     { |                     { | ||||||
| @@ -815,7 +816,7 @@ static void ShowDemoWindowWidgets() | |||||||
|                     // use BulletText() or advance the cursor by GetTreeNodeToLabelSpacing() and call Text(). |                     // use BulletText() or advance the cursor by GetTreeNodeToLabelSpacing() and call Text(). | ||||||
|                     node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet |                     node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet | ||||||
|                     ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Leaf %d", i); |                     ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Leaf %d", i); | ||||||
|                     if (ImGui::IsItemClicked()) |                     if (ImGui::IsItemClicked() && !ImGui::IsItemToggledOpen()) | ||||||
|                         node_clicked = i; |                         node_clicked = i; | ||||||
|                     if (test_drag_and_drop && ImGui::BeginDragDropSource()) |                     if (test_drag_and_drop && ImGui::BeginDragDropSource()) | ||||||
|                     { |                     { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user