So I looked up a tutorial on how to scale sprites in XNA and I think I have it all figured out.

The only problem is that I want to use a spriteBatch.Begin() method overload without changing anything except for the Matrix.

The only spriteBatch.Begin() method that has a Matrix as a parameter is this one:

public void Begin (
         SpriteSortMode sortMode,
         BlendState blendState,
         SamplerState samplerState,
         DepthStencilState depthStencilState,
         RasterizerState rasterizerState,
         Effect effect,
         Matrix transformMatrix

I don't really want to mess around with any of the parameters except to pass in my matrix. How would I do that?


2 Answers 2


If you simply want to scale a sprite you can do

spriteBatch.Draw(texture, position, null, Color.White, 0f, 
Vector2.Zero, 0.5f, SpriteEffects.None, 0f);


spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, 
spriteBatch.Draw(texture, position, Color.White);

Where 0.5f means 50% of the normal size of your texture. You could also use a Vector2(x,y) instead of a float, where the x would be the resize on width, and y the resize on y.


If you are looking to use a Matrix as a camera and to scale and rotate the scene then spriteBatch.Begin() is indeed what you are looking for. Now I know it looks like a lot of parameters but you can actually assign most of them null values. For example:

spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, YourMatrix);

You can find out what the SpriteSortModes do here, but Deferred is usually what you'll want. It's really worth it to familiarize yourself with the other parameters though and you can find them on the MSDN docs as well.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .