mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-15 15:09:29 +00:00
Changed the Flip Flag array to be private and readonly and added a public property that returns the backing field as a ReadOnlySpan.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
|
||||
namespace MonoGame.Extended.Tiled.Renderers
|
||||
{
|
||||
@@ -9,12 +10,14 @@ namespace MonoGame.Extended.Tiled.Renderers
|
||||
{
|
||||
Vertices = vertices;
|
||||
AnimatedTilesetTiles = animatedTilesetTiles;
|
||||
AnimatedTilesetFlipFlags = animatedTilesetTileFlipFlags;
|
||||
_animatedTilesetFlipFlags = animatedTilesetTileFlipFlags;
|
||||
}
|
||||
|
||||
public VertexPositionTexture[] Vertices { get; }
|
||||
public TiledMapTilesetAnimatedTile[] AnimatedTilesetTiles { get; }
|
||||
public TiledMapTileFlipFlags[] AnimatedTilesetFlipFlags { get; }
|
||||
private readonly TiledMapTileFlipFlags[] _animatedTilesetFlipFlags;
|
||||
|
||||
public ReadOnlySpan<TiledMapTileFlipFlags> AnimatedTilesetFlipFlags => _animatedTilesetFlipFlags;
|
||||
|
||||
protected override VertexBuffer CreateVertexBuffer(GraphicsDevice graphicsDevice, int vertexCount)
|
||||
{
|
||||
|
||||
@@ -61,9 +61,8 @@ namespace MonoGame.Extended.Tiled.Renderers
|
||||
fixed (VertexPositionTexture* fixedVerticesPointer = animatedModel.Vertices)
|
||||
{
|
||||
var verticesPointer = fixedVerticesPointer;
|
||||
|
||||
for (int i = 0; i < animatedModel.AnimatedTilesetTiles.Length; i++)
|
||||
{
|
||||
{
|
||||
var currentFrameTextureCoordinates = animatedModel.AnimatedTilesetTiles[i].CurrentAnimationFrame.GetTextureCoordinates(animatedModel.AnimatedTilesetFlipFlags[i]);
|
||||
|
||||
// ReSharper disable ArrangeRedundantParentheses
|
||||
|
||||
Reference in New Issue
Block a user