// 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 extent. /// public partial struct VkExtent2D : IEquatable { /// /// An with all of its components set to zero. /// public static readonly VkExtent2D Zero = new VkExtent2D(0, 0); /// /// Initializes a new instance of structure. /// /// The width component of the extent. /// The height component of the extent. public VkExtent2D(uint width, uint height) { this.width = width; this.height = height; } /// /// Initializes a new instance of structure. /// /// The width component of the extent. /// The height component of the extent. public VkExtent2D(int width, int height) { this.width = (uint)width; this.height = (uint)height; } /// /// 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 VkExtent2D other) { return other.width == width && other.height == height; } /// /// 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(VkExtent2D 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 VkExtent2D && Equals((VkExtent2D)obj); } /// /// Returns the hash code for this instance. /// /// The hash code. public override int GetHashCode() { unchecked { int hashCode = width.GetHashCode(); hashCode = (hashCode * 397) ^ height.GetHashCode(); return hashCode; } } /// /// Returns a boolean indicating whether the two given extents are equal. /// /// The first extent to compare. /// The second extent to compare. /// true if the extents are equal; false otherwise. public static bool operator ==(VkExtent2D left, VkExtent2D right) => left.Equals(ref right); /// /// Returns a boolean indicating whether the two given extents are not equal. /// /// The first extent to compare. /// The second extent to compare. /// /// true if the extents are not equal; false if they are equal. /// public static bool operator !=(VkExtent2D left, VkExtent2D right) => !left.Equals(ref right); } }