tags:

views:

192

answers:

1

I am loading a Texture2D that contains multiple sprite textures. I would like to pull the individual textures out when I load the initial Texture to store into separate Texture2D objects, but can't seem to find a method any where that would let me do this. SpriteBatch.Draw I believe should only be called from within a begin, end block right?

Thanks.

+1  A: 

I am loading a Texture2D that contains multiple sprite textures. I would like to pull the individual textures out when I load the initial Texture to store into separate Texture2D objects.

You don't have to do this nor should you. Accessing a single texture is faster than multiple textures. Also, textures are stored in GPU texture memory. It just makes no sense to split it up.

You should instead focus on writing code that can access individual sprites within your sprite sheet. I suggest you have a look at how sprite based games work.

Here is a great tutorial video series that should help you out: tile engine videos

Arriu
I came across this same information. I have refactored my code to use a source rectangle instead of each Sprite storing a Texture2D.
Casey