Is there a built in way of drawing a texture in a pattern using instead of just stretching to fill the whole rectangle? I know you can easily do this with a loop like so:
for (int i = 0; i < 5; i++) {
for (int a = 0; a < 5; a++) {
spriteBatch.Draw(myTexture, ...);
}
}
but I’m curious if there is a built in function for this since it’s probably used very often.
In your call to
SpriteBatch.Begin(), specify one of the wrappingSamplerStates. Then, when you draw a sprite, specify a source rectangle that’s larger than the texture. This will be translated into u/v coordinates greater than 1, which will wrap the texture.