mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 05:31:12 +01:00
Changed DS4Color to use IEquatable interface
Allows for faster Equals method than the previous implementation
This commit is contained in:
parent
df1ec44f1c
commit
ec71282ce3
@ -12,7 +12,7 @@ using DS4Windows.DS4Library;
|
||||
|
||||
namespace DS4Windows
|
||||
{
|
||||
public struct DS4Color
|
||||
public struct DS4Color : IEquatable<DS4Color>
|
||||
{
|
||||
public byte red;
|
||||
public byte green;
|
||||
@ -31,15 +31,9 @@ namespace DS4Windows
|
||||
blue = b;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public bool Equals(DS4Color other)
|
||||
{
|
||||
if (obj is DS4Color)
|
||||
{
|
||||
DS4Color dsc = ((DS4Color)obj);
|
||||
return (this.red == dsc.red && this.green == dsc.green && this.blue == dsc.blue);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return this.red == other.red && this.green == other.green && this.blue == other.blue;
|
||||
}
|
||||
|
||||
public Color ToColor => Color.FromArgb(red, green, blue);
|
||||
|
Loading…
x
Reference in New Issue
Block a user