瀏覽代碼

Added = operator

Added assign operator since there is a copy constructor. (More consistent)
cosmy1 10 年之前
父節點
當前提交
ac5aac32f2
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      Source/Urho3D/Math/Color.h

+ 10 - 0
Source/Urho3D/Math/Color.h

@@ -89,6 +89,16 @@ public:
         a_(data[3])
     {
     }
+    
+    /// Assign from another color.
+    Color& operator =(const Color& rhs)
+    {
+        r_ = rhs.r_;
+        g_ = rhs.g_;
+        b_ = rhs.b_;
+        a_ = rhs.a_;
+        return *this;
+    }    
 
     /// Test for equality with another color without epsilon.
     bool operator ==(const Color& rhs) const { return r_ == rhs.r_ && g_ == rhs.g_ && b_ == rhs.b_ && a_ == rhs.a_; }