OSDN Git Service

Ellipse. Added constructor and setters
authorAlex Vega <semtiko@gmail.com>
Wed, 18 Sep 2013 23:45:09 +0000 (03:45 +0400)
committerAlex Vega <semtiko@gmail.com>
Wed, 18 Sep 2013 23:45:09 +0000 (03:45 +0400)
gdx/src/com/badlogic/gdx/math/Ellipse.java

index 76218d2..2a09b94 100644 (file)
@@ -19,6 +19,13 @@ public class Ellipse implements Serializable {
 \r
        }\r
 \r
+       public Ellipse (Ellipse ellipse) {\r
+               this.x = ellipse.x;\r
+               this.y = ellipse.y;\r
+               this.width = ellipse.width;\r
+               this.height = ellipse.height;\r
+       }\r
+\r
        public Ellipse (float x, float y, float width, float height) {\r
                this.x = x;\r
                this.y = y;\r
@@ -51,11 +58,42 @@ public class Ellipse implements Serializable {
                this.height = height;\r
        }\r
 \r
-       public void set (Ellipse ellipse) { \r
+       public void set (Ellipse ellipse) {\r
                x = ellipse.x;\r
                y = ellipse.y;\r
                width = ellipse.width;\r
                height = ellipse.height;\r
        }\r
-       \r
+\r
+       /** Sets the x and y-coordinates of ellipse center from vector\r
+        * @param position The position vector \r
+        * @return this ellipse for chaining */\r
+       public Ellipse setPosition (Vector2 position) {\r
+               this.x = position.x;\r
+               this.y = position.y;\r
+\r
+               return this;\r
+       }\r
+\r
+       /** Sets the x and y-coordinates of ellipse center\r
+        * @param x The x-coordinate\r
+        * @param y The y-coordinate \r
+        * @return this ellipse for chaining */\r
+       public Ellipse setPosition (float x, float y) {\r
+               this.x = x;\r
+               this.y = y;\r
+\r
+               return this;\r
+       }\r
+\r
+       /** Sets the width and height of this ellipse\r
+        * @param width The width\r
+        * @param height The height \r
+        * @return this ellipse for chaining */\r
+       public Ellipse setSize (float width, float height) {\r
+               this.width = width;\r
+               this.height = height;\r
+\r
+               return this;\r
+       }\r
 }\r