// Copyright (c) 2017 Eric Mellino // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; namespace Vulkan { /// /// Structure specifying a two-dimensional offset. /// public partial struct VkOffset2D : IEquatable { /// /// An with all of its components set to zero. /// public static readonly VkOffset2D Zero; public VkOffset2D(int x, int y) { this.x = x; this.y = y; } /// /// Determines whether the specified is equal to this instance. /// /// The to compare with this instance. /// /// true if the specified is equal to this instance; otherwise, false. /// public bool Equals(ref VkOffset2D other) { return other.x == x && other.y == y; } /// /// Determines whether the specified is equal to this instance. /// /// The to compare with this instance. /// /// true if the specified is equal to this instance; otherwise, false. /// public bool Equals(VkOffset2D other) { return Equals(ref other); } /// /// Determines whether the specified is equal to this instance. /// /// The to compare with this instance. /// /// true if the specified is equal to this instance; otherwise, false. /// public override bool Equals(object obj) { return obj is VkOffset2D && Equals((VkOffset2D)obj); } /// /// Returns the hash code for this instance. /// /// The hash code. public override int GetHashCode() { unchecked { int hashCode = x; hashCode = (hashCode * 397) ^ y; return hashCode; } } /// /// Returns a boolean indicating whether the two given offsets are equal. /// /// The first offset to compare. /// The second offset to compare. /// true if the offsets are equal; false otherwise. public static bool operator ==(VkOffset2D left, VkOffset2D right) => left.Equals(ref right); /// /// Returns a boolean indicating whether the two given offsets are not equal. /// /// The first offset to compare. /// The second offset to compare. /// /// true if the offsets are not equal; false if they are equal. /// public static bool operator !=(VkOffset2D left, VkOffset2D right) => !left.Equals(ref right); } }