Przeglądaj źródła

New Rect capabilities

Brian Fiete 5 lat temu
rodzic
commit
b756fe50eb
1 zmienionych plików z 32 dodań i 0 usunięć
  1. 32 0
      BeefLibs/Beefy2D/src/geom/Rect.bf

+ 32 - 0
BeefLibs/Beefy2D/src/geom/Rect.bf

@@ -18,6 +18,12 @@ namespace Beefy.geom
 			{
 				return mX;
 			}
+
+			set mut
+			{
+				mWidth = mX + mWidth - value;
+				mX = value;
+			}
 		}
 
 		public float Top
@@ -26,6 +32,12 @@ namespace Beefy.geom
 			{
 				return mY;
 			}
+
+			set mut
+			{
+				mHeight = mY + mHeight - value;
+				mY = value;
+			}
 		}
 
 		public float Right
@@ -34,6 +46,11 @@ namespace Beefy.geom
 			{
 				return mX + mWidth;
 			}
+
+			set mut
+			{
+				mWidth = value - mX;
+			}
 		}
 
 		public float Bottom
@@ -42,6 +59,11 @@ namespace Beefy.geom
 			{
 				return mY + mHeight;
 			}
+
+			set mut
+			{
+				mHeight = value - mY;
+			}
 		}
 
 		public float Width
@@ -50,6 +72,11 @@ namespace Beefy.geom
 			{
 				return mWidth;
 			}
+
+			set mut
+			{
+				mWidth = value;
+			}
 		}
 
 		public float Height
@@ -58,6 +85,11 @@ namespace Beefy.geom
 			{
 				return mHeight;
 			}
+
+			set mut
+			{
+				mHeight = value;
+			}
 		}
 
         public this(float x = 0, float y = 0, float width = 0, float height = 0)