瀏覽代碼

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

Rokas Kupstys 8 年之前
父節點
當前提交
46785cb0c2
共有 1 個文件被更改,包括 7 次插入1 次删除
  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.
-    IntVector2(const int* data) :
+    explicit IntVector2(const int* data) :
         x_(data[0]),
         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.
     IntVector2(const IntVector2& rhs) :
         x_(rhs.x_),