blob: 3e762a09fc8b4e4c1461ca408801050e61c7e7d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// Copyright (c) 2017 Eric Mellino
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
namespace Vulkan {
/// <summary>
/// Structure specifying a two-dimensional offset.
/// </summary>
public partial struct VkOffset2D : IEquatable<VkOffset2D>
{
/// <summary>
/// An <see cref="VkOffset2D"/> with all of its components set to zero.
/// </summary>
public static readonly VkOffset2D Zero;
public VkOffset2D(int x, int y)
{
this.x = x;
this.y = y;
}
/// <summary>
/// Determines whether the specified <see cref="VkOffset2D"/> is equal to this instance.
/// </summary>
/// <param name="other">The <see cref="VkOffset2D"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="VkOffset2D"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public bool Equals(ref VkOffset2D other)
{
return other.x == x && other.y == y;
}
/// <summary>
/// Determines whether the specified <see cref="VkOffset2D"/> is equal to this instance.
/// </summary>
/// <param name="other">The <see cref="VkOffset2D"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="VkOffset2D"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public bool Equals(VkOffset2D other)
{
return Equals(ref other);
}
/// <summary>
/// Determines whether the specified <see cref="object"/> is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
return obj is VkOffset2D && Equals((VkOffset2D)obj);
}
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
unchecked
{
int hashCode = x;
hashCode = (hashCode * 397) ^ y;
return hashCode;
}
}
/// <summary>
/// Returns a boolean indicating whether the two given offsets are equal.
/// </summary>
/// <param name="left">The first offset to compare.</param>
/// <param name="right">The second offset to compare.</param>
/// <returns><c>true</c> if the offsets are equal; <c>false</c> otherwise.</returns>
public static bool operator ==(VkOffset2D left, VkOffset2D right) => left.Equals(ref right);
/// <summary>
/// Returns a boolean indicating whether the two given offsets are not equal.
/// </summary>
/// <param name="left">The first offset to compare.</param>
/// <param name="right">The second offset to compare.</param>
/// <returns>
/// <c>true</c> if the offsets are not equal; <c>false</c> if they are equal.
/// </returns>
public static bool operator !=(VkOffset2D left, VkOffset2D right) => !left.Equals(ref right);
}
}
|