2
0

Rect2I.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. namespace BansheeEngine
  7. {
  8. [StructLayout(LayoutKind.Sequential)]
  9. public class Rect2I
  10. {
  11. public Rect2I(int x, int y, int width, int height)
  12. {
  13. this.x = x;
  14. this.y = y;
  15. this.width = width;
  16. this.height = height;
  17. }
  18. public static bool operator== (Rect2I lhs, Rect2I rhs)
  19. {
  20. return lhs.x == rhs.x && lhs.y == rhs.y && lhs.width == rhs.width && lhs.height == rhs.height;
  21. }
  22. public static bool operator!= (Rect2I lhs, Rect2I rhs)
  23. {
  24. return !(lhs == rhs);
  25. }
  26. public override bool Equals(object other)
  27. {
  28. if (!(other is Rect2I))
  29. return false;
  30. Rect2I rect = (Rect2I)other;
  31. if (x.Equals(rect.x) && y.Equals(rect.y) && width.Equals(rect.width) && height.Equals(rect.height))
  32. return true;
  33. return false;
  34. }
  35. public override int GetHashCode()
  36. {
  37. return base.GetHashCode();
  38. }
  39. public int x, y, width, height;
  40. }
  41. }