Browse Source

Added optional parameter for imguiEndScrollArea().

Dario Manesku 11 years ago
parent
commit
4501e17f4b
2 changed files with 61 additions and 25 deletions
  1. 60 24
      examples/common/imgui/imgui.cpp
  2. 1 1
      examples/common/imgui/imgui.h

+ 60 - 24
examples/common/imgui/imgui.cpp

@@ -753,7 +753,7 @@ struct Imgui
 		return m_insideScrollArea;
 	}
 
-	void endScrollArea()
+	void endScrollArea(int32_t _r)
 	{
 		// Disable scissoring.
 		m_scissor = UINT16_MAX;
@@ -802,34 +802,70 @@ struct Imgui
 			}
 
 			// BG
-			drawRoundedRect( (float)xx
-				, (float)yy
-				, (float)width
-				, (float)height
-				, (float)width / 2 - 1
-				, imguiRGBA(0, 0, 0, 196)
-				);
+			if (0 == _r)
+			{
+				drawRect( (float)xx
+					, (float)yy
+					, (float)width
+					, (float)height
+					, imguiRGBA(0, 0, 0, 196)
+					);
+			}
+			else
+			{
+				drawRoundedRect( (float)xx
+					, (float)yy
+					, (float)width
+					, (float)height
+					, (float)_r
+					, imguiRGBA(0, 0, 0, 196)
+					);
+			}
 
 			// Bar
 			if (isActive(hid) )
 			{
-				drawRoundedRect( (float)hx
-					, (float)hy
-					, (float)hw
-					, (float)hh
-					, (float)width / 2 - 1
-					, imguiRGBA(255, 196, 0, 196)
-					);
+				if (0 == _r)
+				{
+					drawRect( (float)hx
+						, (float)hy
+						, (float)hw
+						, (float)hh
+						, imguiRGBA(255, 196, 0, 196)
+						);
+				}
+				else
+				{
+					drawRoundedRect( (float)hx
+						, (float)hy
+						, (float)hw
+						, (float)hh
+						, (float)_r
+						, imguiRGBA(255, 196, 0, 196)
+						);
+				}
 			}
 			else
 			{
-				drawRoundedRect( (float)hx
-					, (float)hy
-					, (float)hw
-					, (float)hh
-					, (float)width / 2 - 1
-					, isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64)
-					);
+				if (0 == _r)
+				{
+					drawRect( (float)hx
+						, (float)hy
+						, (float)hw
+						, (float)hh
+						, isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64)
+						);
+				}
+				else
+				{
+					drawRoundedRect( (float)hx
+						, (float)hy
+						, (float)hw
+						, (float)hh
+						, (float)_r
+						, isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64)
+						);
+				}
 			}
 
 			// Handle mouse scrolling.
@@ -2485,9 +2521,9 @@ bool imguiBeginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _wi
 	return s_imgui.beginScrollArea(_name, _x, _y, _width, _height, _scroll, _enabled, _r);
 }
 
-void imguiEndScrollArea()
+void imguiEndScrollArea(int32_t _r)
 {
-	s_imgui.endScrollArea();
+	s_imgui.endScrollArea(_r);
 }
 
 void imguiIndent(uint16_t _width)

+ 1 - 1
examples/common/imgui/imgui.h

@@ -91,7 +91,7 @@ void imguiEndFrame();
 bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled = true);
 
 bool imguiBeginScrollArea(const char* _name, int _x, int _y, int _width, int _height, int* _scroll, bool _enabled = true, int32_t _r = 6);
-void imguiEndScrollArea();
+void imguiEndScrollArea(int32_t _r = 5);
 
 void imguiIndent(uint16_t _width = 16);
 void imguiUnindent(uint16_t _width = 16);