Procházet zdrojové kódy

Added clone for Vector2

Christian Wolfgang před 5 roky
rodič
revize
3d47c1521a
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6 0
      math32/vector2.go

+ 6 - 0
math32/vector2.go

@@ -23,6 +23,12 @@ func NewVec2() *Vector2 {
 	return &Vector2{X: 0, Y: 0}
 }
 
+// Clone returns a copy of this vector
+func (v *Vector2) Clone() *Vector2 {
+
+	return NewVector2(v.X, v.Y)
+}
+
 // Set sets this vector X and Y components.
 // Returns the pointer to this updated vector.
 func (v *Vector2) Set(x, y float32) *Vector2 {