Drawing sprites with sprite.draw2D in vb.net

shamuse

Newcomer
Joined
Jun 19, 2008
Messages
4
Hey,

So I've recently begun working with directx in vb.net but Ive run in to a small problem. I can only render sprites that have power of 2 dimensions. I am aware that the texture of the sprite has to be based off an image with power of 2 dimensions, but Im fairly sure that there must be a way to render the spirte itself in something other than power of 2 dimensions using sprite.draw2d.

It would be great if any of you could help me.

Thanks!:)
 
well, maybe I'm missing something, but if I can only render sprites with power of 2 dimensions there's only a certain amount of sprite sizes I can pick from. So I cant get exact sprite sizes.
 
I'm still a little confused. As far as I can tell the only parameters you can plug in to either textureloader.fromfile or sprite.draw2D are integers.

Also, I should have mentioned this earlier, but if I try to scale it by plugginig in numbers that are not powers of 2 in the parameters for length and width in the textureloader.fromfile function it automatically rounds up to the length/width to the next power of two.
 
Yes, PD is correct: something roughly like this should work for you.
C#:
sprite.Begin(SpriteFlags.None);

sprite.Draw2D(texture, Rectangle.Empty, Rectangle.Empty,
              new Point(5.0f, 5.0f), Color.White);
sprite.End();
 
Back
Top