mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Added NewLine() (very shy reminder that #97 isn't done)
This commit is contained in:
		
							
								
								
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -9122,6 +9122,17 @@ void ImGui::SameLine(float pos_x, float spacing_w) | ||||
|     window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset; | ||||
| } | ||||
|  | ||||
| void ImGui::NewLine() | ||||
| { | ||||
|     ImGuiWindow* window = GetCurrentWindow(); | ||||
|     if (window->SkipItems) | ||||
|         return; | ||||
|     if (window->DC.CurrentLineHeight > 0.0f)     // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height. | ||||
|         ItemSize(ImVec2(0,0)); | ||||
|     else | ||||
|         ItemSize(ImVec2(0.0f, GImGui->FontSize)); | ||||
| } | ||||
|  | ||||
| void ImGui::NextColumn() | ||||
| { | ||||
|     ImGuiWindow* window = GetCurrentWindow(); | ||||
|   | ||||
							
								
								
									
										1
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -191,6 +191,7 @@ namespace ImGui | ||||
|     // Cursor / Layout | ||||
|     IMGUI_API void          Separator();                                                        // horizontal line | ||||
|     IMGUI_API void          SameLine(float pos_x = 0.0f, float spacing_w = -1.0f);              // call between widgets or groups to layout them horizontally | ||||
|     IMGUI_API void          NewLine();                                                          // undo a SameLine() | ||||
|     IMGUI_API void          Spacing();                                                          // add spacing | ||||
|     IMGUI_API void          Dummy(const ImVec2& size);                                          // add a dummy item of given size | ||||
|     IMGUI_API void          Indent();                                                           // move content position toward the right by style.IndentSpacing pixels | ||||
|   | ||||
| @@ -384,14 +384,14 @@ void ImGui::ShowTestWindow(bool* p_open) | ||||
|             static int pressed_count = 0; | ||||
|             for (int i = 0; i < 8; i++) | ||||
|             { | ||||
|                 if (i > 0) | ||||
|                     ImGui::SameLine(); | ||||
|                 ImGui::PushID(i); | ||||
|                 int frame_padding = -1 + i;     // -1 = uses default padding | ||||
|                 if (ImGui::ImageButton(tex_id, ImVec2(32,32), ImVec2(0,0), ImVec2(32.0f/tex_w,32/tex_h), frame_padding, ImColor(0,0,0,255))) | ||||
|                     pressed_count += 1; | ||||
|                 ImGui::PopID(); | ||||
|                 ImGui::SameLine(); | ||||
|             } | ||||
|             ImGui::NewLine(); | ||||
|             ImGui::Text("Pressed %d times.", pressed_count); | ||||
|             ImGui::TreePop(); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user