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
EffectGeometry.cs
1using System.Drawing;
2
3namespace Gondwana.Effects;
4
5internal static class EffectGeometry
6{
7 internal static RectangleF GetRevealRect(
8 RectangleF bounds,
9 EffectDirection direction,
10 float progress)
11 {
12 progress = Math.Clamp(progress, 0f, 1f);
13
14 if (progress <= 0f || bounds.Width <= 0f || bounds.Height <= 0f)
15 return RectangleF.Empty;
16
17 if (progress >= 1f || direction == EffectDirection.None)
18 return bounds;
19
20 float width = bounds.Width * progress;
21 float height = bounds.Height * progress;
22
23 return direction switch
24 {
25 EffectDirection.FromLeftToRight =>
26 new RectangleF(bounds.Left, bounds.Top, width, bounds.Height),
27 EffectDirection.FromRightToLeft =>
28 new RectangleF(bounds.Right - width, bounds.Top, width, bounds.Height),
29 EffectDirection.FromTopToBottom =>
30 new RectangleF(bounds.Left, bounds.Top, bounds.Width, height),
31 EffectDirection.FromBottomToTop =>
32 new RectangleF(bounds.Left, bounds.Bottom - height, bounds.Width, height),
33 EffectDirection.FromTopLeftToBottomRight =>
34 new RectangleF(bounds.Left, bounds.Top, width, height),
35 EffectDirection.FromTopRightToBottomLeft =>
36 new RectangleF(bounds.Right - width, bounds.Top, width, height),
37 EffectDirection.FromBottomLeftToTopRight =>
38 new RectangleF(bounds.Left, bounds.Bottom - height, width, height),
39 EffectDirection.FromBottomRightToTopLeft =>
40 new RectangleF(bounds.Right - width, bounds.Bottom - height, width, height),
41 _ => bounds
42 };
43 }
44}
EffectDirection
Specifies the direction in which a directional display effect travels.