Drawing part of a Texture2D
Forum » MIDI Game Forums / Programming » Drawing part of a Texture2D
Started by: BenHumberstonBenHumberston
On: 1175227929|%e %b %Y, %H:%M %Z|agohover
Number of posts: 2
rss icon RSS: New posts
Drawing part of a Texture2D
BenHumberstonBenHumberston 1175227929|%e %b %Y, %H:%M %Z|agohover

Hmm… this shouldn't be so hard to figure out.

Do any of you guys know how to draw just a part of an image, like what you would do to draw an animation where you just want to draw a small part of the whole texture?

unfold Drawing part of a Texture2D by BenHumberstonBenHumberston, 1175227929|%e %b %Y, %H:%M %Z|agohover
Re: Drawing part of a Texture2D
KevinoidKevinoid 1175255090|%e %b %Y, %H:%M %Z|agohover

Not sure if you are talking about 2D or 3D drawing, but I will guess 2D. If it is 3D you may get more help from Gordon or Sasha. For 2D textures (drawn using a SpriteBatch), all you need to do is use one of the overloads of Draw() that takes a parameter for a source rectangle. See MSDN for a list of the overloads (or use IntelliSense in XNA studio). By the way, there is an overview of some of the 2D stuff here, but it is not really detailed…

unfold Re: Drawing part of a Texture2D by KevinoidKevinoid, 1175255090|%e %b %Y, %H:%M %Z|agohover
New post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.