feat: ISpriteBatch added for MonoGame integration
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
using Syntriax.Engine.Core;
|
||||
|
||||
namespace Syntriax.Engine.Integration.MonoGame;
|
||||
@@ -9,8 +7,10 @@ namespace Syntriax.Engine.Integration.MonoGame;
|
||||
public class SpriteBatcher : BehaviourBase, IFirstFrameUpdate, IDraw
|
||||
{
|
||||
private static Comparer<IBehaviour> SortByPriority() => Comparer<IBehaviour>.Create((x, y) => y.Priority.CompareTo(x.Priority));
|
||||
private SpriteBatch spriteBatch = null!;
|
||||
|
||||
private ISpriteBatch spriteBatch = null!;
|
||||
private MonoGameCamera2DBehaviour camera2D = null!;
|
||||
|
||||
private readonly ActiveBehaviourCollectorSorted<IDrawableSprite> drawableSprites = new() { SortBy = SortByPriority() };
|
||||
|
||||
public void FirstActiveFrame()
|
||||
@@ -18,7 +18,7 @@ public class SpriteBatcher : BehaviourBase, IFirstFrameUpdate, IDraw
|
||||
MonoGameWindowContainer windowContainer = Universe.FindRequiredBehaviour<MonoGameWindowContainer>();
|
||||
camera2D = Universe.FindRequiredBehaviour<MonoGameCamera2DBehaviour>();
|
||||
|
||||
spriteBatch = new(windowContainer.Window.GraphicsDevice);
|
||||
spriteBatch = new SpriteBatchWrapper(windowContainer.Window.GraphicsDevice);
|
||||
drawableSprites.Unassign();
|
||||
drawableSprites.Assign(Universe);
|
||||
}
|
||||
|
Reference in New Issue
Block a user