Răsfoiți Sursa

Mark IntVector(const int*) constructor as explicit and add IntVector(const float*) constructor

Rokas Kupstys 8 ani în urmă
părinte
comite
46785cb0c2
1 a modificat fișierele cu 7 adăugiri și 1 ștergeri
  1. 7 1
      Source/Urho3D/Math/Vector2.h

+ 7 - 1
Source/Urho3D/Math/Vector2.h

@@ -47,12 +47,18 @@ public:
     }
     }
 
 
     /// Construct from an int array.
     /// Construct from an int array.
-    IntVector2(const int* data) :
+    explicit IntVector2(const int* data) :
         x_(data[0]),
         x_(data[0]),
         y_(data[1])
         y_(data[1])
     {
     {
     }
     }
 
 
+    /// Construct from an float array.
+    explicit IntVector2(const float* data) :
+        x_((int)data[0]),
+        y_((int)data[1])
+    {
+    }
     /// Copy-construct from another vector.
     /// Copy-construct from another vector.
     IntVector2(const IntVector2& rhs) :
     IntVector2(const IntVector2& rhs) :
         x_(rhs.x_),
         x_(rhs.x_),