浏览代码

Added color comparison

Eiyeron Fulmincendii 9 年之前
父节点
当前提交
0a3435694d
共有 2 个文件被更改,包括 7 次插入0 次删除
  1. 5 0
      src/render/Pixel.cpp
  2. 2 0
      src/render/Pixel.h

+ 5 - 0
src/render/Pixel.cpp

@@ -26,6 +26,11 @@ PIXEL &PIXEL::operator=(unsigned value)
     return *this;
 }
 
+bool PIXEL::operator==(const PIXEL& col)
+{
+	return value == col.value;
+}
+
 #define CONST_COLOR(color, r, g, b) \
     const WalrusRPG::Graphics::Pixel WalrusRPG::Graphics::color(r, g, b)
 CONST_COLOR(Black, 0, 0, 0);

+ 2 - 0
src/render/Pixel.h

@@ -36,6 +36,8 @@ namespace WalrusRPG
             operator std::uint16_t() const;
 
             Pixel &operator=(unsigned value);
+           
+            bool operator==(const Pixel&col);
         };
 
         extern const Pixel Black;