Sorry I cannot be more specific about the title, wasn’t sure what to say other than that.
When beginning a spritebatch, drawing a texture at depth 1.0, ending then doing the same at 0.1, the one at 0.1 shows first. Why would I want to do that? Well the reason is because I want to change the spritebatch arguments(ie the matrix).
I know this isn’t a problem to do with monogame, but how would I do this?(change sprite batch arguments without ending)
Any help is appreciated, a clean project(without the spritebatch arguments) is bellow:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace Game6 {
public class Game1 : Game {
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
private Texture2D texture1;
private Texture2D texture2;
public Game1() {
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize() {
base.Initialize();
}
protected override void LoadContent() {
spriteBatch = new SpriteBatch(GraphicsDevice);
texture1 = Content.Load<Texture2D>("texture1");
texture2 = Content.Load<Texture2D>("texture2");
}
protected override void UnloadContent() {
}
protected override void Update(GameTime gameTime) {
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(texture2, new Rectangle(0, 0, texture2.Width, texture2.Height), new Rectangle(0, 0, texture2.Width, texture2.Height), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 1f);
spriteBatch.End();
spriteBatch.Begin();
spriteBatch.Draw(texture1, new Rectangle(0, 0, texture2.Width, texture2.Height), new Rectangle(0, 0, texture2.Width, texture2.Height), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.1f);
spriteBatch.End();
base.Draw(gameTime);
}
}
}
`