Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
CollisionAdjust.cs
1using System.Drawing;
2using Newtonsoft.Json;
3
5
15public struct CollisionAdjust : IEquatable<CollisionAdjust>
16{
20 [JsonProperty]
21 public int Top { get; set; }
22
26 [JsonProperty]
27 public int Bottom { get; set; }
28
32 [JsonProperty]
33 public int Left { get; set; }
34
38 [JsonProperty]
39 public int Right { get; set; }
40
44 public static readonly CollisionAdjust None = new();
45
53 public CollisionAdjust(int top, int bottom, int left, int right)
54 {
55 Top = top;
56 Bottom = bottom;
57 Left = left;
58 Right = right;
59 }
60
66 public readonly Rectangle ApplyTo(Rectangle rectangle)
67 {
68 return Rectangle.FromLTRB(
69 rectangle.Left + Left,
70 rectangle.Top + Top,
71 rectangle.Right - Right,
72 rectangle.Bottom - Bottom);
73 }
74
76 public readonly bool Equals(CollisionAdjust other) =>
77 Top == other.Top &&
78 Bottom == other.Bottom &&
79 Left == other.Left &&
80 Right == other.Right;
81
83 public override readonly bool Equals(object? obj) =>
84 obj is CollisionAdjust other && Equals(other);
85
87 public override readonly int GetHashCode() =>
88 HashCode.Combine(Top, Bottom, Left, Right);
89
96 public static bool operator ==(CollisionAdjust left, CollisionAdjust right) =>
97 left.Equals(right);
98
105 public static bool operator !=(CollisionAdjust left, CollisionAdjust right) =>
106 !left.Equals(right);
107}
int Top
Gets or sets the number of pixels by which to inset the top edge.
readonly bool Equals(CollisionAdjust other)
static readonly CollisionAdjust None
Represents an adjustment with no pixel offsets.
static bool operator==(CollisionAdjust left, CollisionAdjust right)
Determines whether two adjustments are equal.
int Left
Gets or sets the number of pixels by which to inset the left edge.
override readonly bool Equals(object? obj)
int Bottom
Gets or sets the number of pixels by which to inset the bottom edge.
readonly Rectangle ApplyTo(Rectangle rectangle)
Applies this adjustment to the supplied rectangle.
int Right
Gets or sets the number of pixels by which to inset the right edge.
CollisionAdjust(int top, int bottom, int left, int right)
Initializes a new instance of the CollisionAdjust struct.
static bool operator!=(CollisionAdjust left, CollisionAdjust right)
Determines whether two adjustments are not equal.