소스 검색

Added some equality operators. Resolves #194.

Brucey 5 년 전
부모
커밋
92f9f6df1e
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      color.mod/color.bmx

+ 14 - 0
color.mod/color.bmx

@@ -87,6 +87,20 @@ Struct SColor8
 		ToHSVL(hue, saturation, value, True)	
 		ToHSVL(hue, saturation, value, True)	
 	End Method
 	End Method
 	
 	
+	Rem
+	bbdoc: Returns #True if the components of this color and @col are equal.
+	End Rem
+	Method Operator = :Int(col:SColor8)
+		Return r = col.r And g = col.g And b = col.b And a = col.a
+	End Method
+
+	Rem
+	bbdoc: Returns #True if the components of this color and @col are not equal.
+	End Rem
+	Method Operator <> :Int(col:SColor8)
+		Return r <> col.r Or g <> col.g Or b <> col.b Or a <> col.a
+	End Method
+	
 Private
 Private
 	Method ToHSVL(hue:Float Var, saturation:Float Var, value:Float Var, isValue:Int)
 	Method ToHSVL(hue:Float Var, saturation:Float Var, value:Float Var, isValue:Int)
 		Local rf:Float = r / 255.0
 		Local rf:Float = r / 255.0