开发者

copying a texture in xna into another texture

开发者 https://www.devze.com 2022-12-13 02:04 出处:网络
I am loading a Texture2D that contains multiple sprite textures. I would like to pull the individual textur开发者_如何学编程es out when I load the initial Texture to store into separate Texture2D obje

I am loading a Texture2D that contains multiple sprite textures. I would like to pull the individual textur开发者_如何学编程es 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消