Sfoglia il codice sorgente

Added color comparison

Eiyeron Fulmincendii 9 anni fa
parent
commit
0a3435694d
2 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  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;