mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 13:41:15 +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
|
namespace DS4Windows
|
||||||
{
|
{
|
||||||
public struct DS4Color
|
public struct DS4Color : IEquatable<DS4Color>
|
||||||
{
|
{
|
||||||
public byte red;
|
public byte red;
|
||||||
public byte green;
|
public byte green;
|
||||||
@ -31,15 +31,9 @@ namespace DS4Windows
|
|||||||
blue = b;
|
blue = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public bool Equals(DS4Color other)
|
||||||
{
|
{
|
||||||
if (obj is DS4Color)
|
return this.red == other.red && this.green == other.green && this.blue == other.blue;
|
||||||
{
|
|
||||||
DS4Color dsc = ((DS4Color)obj);
|
|
||||||
return (this.red == dsc.red && this.green == dsc.green && this.blue == dsc.blue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color ToColor => Color.FromArgb(red, green, blue);
|
public Color ToColor => Color.FromArgb(red, green, blue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user