Retrieve texture dimensions from SpriteBatch ?

Dec 27, 2012 at 6:51 PM
Edited Dec 27, 2012 at 6:52 PM

After browsing the source I found out that SpriteBatch had a GetTextureSize() method but it is inaccessible.

Could you make this member public in a future release ?

Thank you.


Jan 7, 2013 at 11:04 PM

What do you need that method for?

The code SpriteBatch uses to do this is just a helper that calls a regular D3D API method (GetDesc) and then loads the resulting values into an XMVECTOR data type.  In general I would think it would be better for your code to go directly to the existing GetDesc method, rather than DirectXTK providing a slightly different API to do basically the same thing.

Or, for maximum efficiency it would be better to just store the size alongside each of your textures (which you presumably know since you loaded/created them in the first place?) and thus avoid having to call any API methods at all...