From 46355ec4911eb3c541d119e1c52d0f1dfd51d120 Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 11 Oct 2023 11:18:27 +0300 Subject: [PATCH] feat: sprites sorting --- src/Libs/Systems/DefaultDrawSystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Libs/Systems/DefaultDrawSystem.cs b/src/Libs/Systems/DefaultDrawSystem.cs index 744fab0..c6531de 100644 --- a/src/Libs/Systems/DefaultDrawSystem.cs +++ b/src/Libs/Systems/DefaultDrawSystem.cs @@ -16,7 +16,8 @@ public DefaultDrawSystem(IGroup group) public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { - GameEntity[] entities = _group.GetEntities(); + // todo: refactor, put it in an impl and use the impl as a dep + GameEntity[] entities = _group.GetEntities().OrderBy(x => x.transform.Position.Y).ToArray(); spriteBatch.Begin(samplerState: SamplerState.PointWrap);