13[JsonObject(IsReference =
true)]
14public class SceneLayerTile :
Tile
16 #region private / internal fields
26 internal Point sceneLayerCoordinates;
28 #endregion private / internal fields
30 #region constructors / finalizer
33 private SceneLayerTile()
48 parentSceneLayer = sceneLayer;
55 internal void EnsureCollider()
61 collisionGroup: CollisionMasks.None,
62 collidesWith: CollisionMasks.None));
80 #endregion constructors / finalizer
85 get => base.EnableFog;
88 bool changed = enableFog != value;
89 base.EnableFog = value;
91 if (changed && !ReferenceEquals(parentSceneLayer,
SceneLayer.Empty))
92 parentSceneLayer.InvalidateFixedGridRenderEligibility();
105 if (!Enum.IsDefined(value))
throw new ArgumentOutOfRangeException(nameof(value));
106 if (_transform == value)
return;
143 base.Draw(backbuffer, destRectScreen);
147 var origin = TileTransformGeometry.MapToDestination(
new(0, 0), destRectScreen,
Transform);
148 var x = TileTransformGeometry.MapToDestination(
new(1, 0), destRectScreen,
Transform);
149 var y = TileTransformGeometry.MapToDestination(
new(0, 1), destRectScreen,
Transform);
150 var matrix =
new global::SkiaSharp.SKMatrix
152 ScaleX = x.X - origin.X,
153 SkewX = y.X - origin.X,
155 SkewY = x.Y - origin.Y,
156 ScaleY = y.Y - origin.Y,
160 var canvas = backbuffer.Canvas;
164 canvas.Concat(ref matrix);
165 base.Draw(backbuffer,
new RectangleF(0, 0, 1, 1));
167 finally { canvas.Restore(); }
173 parentSceneLayer?.TransformedTiles.Remove(
this);
175 GC.SuppressFinalize(
this);
178 #region public properties
198 bool changed = zOrder != value;
201 if (changed && !ReferenceEquals(parentSceneLayer,
SceneLayer.Empty))
202 parentSceneLayer.InvalidateFixedGridRenderEligibility();
227 public override Rectangle
DrawLocationWorld => parentSceneLayer.CoordinateSystem.GetPixelRangeForTile(
this,
true);
338 get {
return (animator !=
null); }
343 if (animator ==
null)
354 #endregion public properties
Manages animation playback for a Tile, controlling animation cycles, frame timing,...
Provides collision detection capabilities for a Tile by implementing the ICollider interface.
Represents an abstract base class for drawable tiles in the Gondwana engine. Provides core functional...
virtual Frame CurrentFrame
Gets or sets the current frame. The initial frame supplies the tile's default collision adjustment an...
void AttachCollider(ICollider collider)
Attaches this tile's collider and applies any collision state that was set before the collider became...
ICollider? _collider
The collider.
virtual CollisionAdjust AdjustCollisionArea
Gets or sets the collision adjustment used to derive CollisionArea.
Represents a base class for managing a graphical backbuffer, and is the in-memory surface where rende...
Point GridCoordinatesAbs
Gets the absolute grid coordinates of this tile within its parent scene layer as integer values.
Spacing EffectiveTilePadding
Gets oriented atlas padding for inspection, never for source slicing.
override void Draw(Gondwana.Rendering.Backbuffers.BackbufferBase backbuffer, RectangleF destRectScreen)
Draws the current content into the backbuffer at the supplied screen-pixel bounds.
override SceneLayer SceneLayer
Gets the parent scene layer that contains this tile.
override int ZOrder
Gets the z-order (rendering depth) of this tile within its layer.
override bool IsPositionFixed
Gets a value indicating whether this tile's position is fixed within its grid.
bool EnableAnimator
Gets or sets a value indicating whether the tile's animator is enabled.
TileTransform Transform
Gets or sets this placement's orthogonal orientation without changing its source frame.
override Spacing Overhang
Gets oriented overhang. The source value remains on CurrentFrame.
CollisionAdjust EffectiveCollisionAdjust
Gets the oriented collision insets, including the current frame-derived adjustment.
override Rectangle CollisionArea
Gets the collision area of this entity in world pixel coordinates.
override PointF SceneLayerCoordinates
Gets the grid coordinates of this tile within its parent scene layer as a floating-point value.
override void Dispose()
Releases the resources owned by this instance.
Size EffectiveTileSize
Gets source frame dimensions after placement orientation.
override Rectangle DrawLocationWorld
Gets the world-space pixel rectangle where this tile should be drawn.
TileTransform
The eight orthogonal orientations of artwork placed in a fixed scene cell.
record struct Spacing([property:JsonProperty("left")] int Left, [property:JsonProperty("top")] int Top, [property:JsonProperty("right")] int Right, [property:JsonProperty("bottom")] int Bottom)
Represents dimensions in pixels when spacing Tilesheets.
Per-edge inset amounts applied to visual bounds to produce a collision rectangle.