Gondwana Game Engine Development (master) - 2.7.0
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
DirectLine.cs
1using System.Drawing;
5using SkiaSharp;
6
8
10public sealed class DirectLine : DirectShapeBase<DirectLine>
11{
12 private PointF[] _points = [new(0, 0), new(1, 1)];
13
15 public DirectLine(Color color, RenderSurfaceHostBase host, SceneLayer sceneLayer, Rectangle worldBounds, string? nickname = null)
16 : base(color, host, DirectDrawingMode.SceneLayer, sceneLayer, null, worldBounds, nickname)
17 {
18 }
19
21 public DirectLine(Color color, RenderSurfaceHostBase host, View view, Rectangle screenBounds, string? nickname = null)
22 : base(color, host, DirectDrawingMode.View, null, view, screenBounds, nickname)
23 {
24 }
25
27 public DirectLine SetEndpoints(PointF start, PointF end)
28 {
29 _points = CopyPoints([start, end], 2);
30 ForceRefresh();
31 return this;
32 }
33
35 protected override void DrawGeometry(SKCanvas canvas, SKRect bounds, SKPaint paint)
36 {
37 PointF[] points = _points;
38
39 if (points is null)
40 return;
41
42 canvas.DrawLine(MapPoint(points[0], bounds), MapPoint(points[1], bounds), paint);
43 }
44}
DirectLine(Color color, RenderSurfaceHostBase host, View view, Rectangle screenBounds, string? nickname=null)
Creates a view-space line within the supplied bounds.
Definition DirectLine.cs:21
override void DrawGeometry(SKCanvas canvas, SKRect bounds, SKPaint paint)
Definition DirectLine.cs:35
DirectLine SetEndpoints(PointF start, PointF end)
Sets endpoints in normalized local coordinates (0 to 1 on each axis).
Definition DirectLine.cs:27
DirectLine(Color color, RenderSurfaceHostBase host, SceneLayer sceneLayer, Rectangle worldBounds, string? nickname=null)
Creates a scene-layer line within the supplied bounds.
Definition DirectLine.cs:15
static SKPoint MapPoint(PointF point, SKRect bounds)
Maps a normalized local point into the drawing bounds.
static PointF[] CopyPoints(IEnumerable< PointF > points, int minimumCount)
Copies and validates a sequence of normalized local points.
DirectShapeBase(Color color, RenderSurfaceHostBase host, DirectDrawingMode mode, SceneLayer? sceneLayer, View? view, Rectangle bounds, string? nickname)
Represents a base class for hosting a render surface, providing functionality for managing rendering ...
DirectDrawingMode
Specifies where direct drawing operations are applied within the rendering pipeline.
@ View
Performs direct drawing at the view level using screen-space coordinates.
@ SceneLayer
Performs direct drawing within a scene layer using world-space coordinates.