• Advertisement
Sign in to follow this  

C++ DirectxTK Spritebatch.Draw problem

This topic is 542 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to get SpriteBatch.Draw to work with the overload that takes in a texture, a world position, and a rectangle.

I can get both the World Position and texture to work just fine. But I can't get the rectangle to work properly.

Looking through simplemath, it shows that Rectangle has some overloads for RECT, which I think is a windows type.

But Visual Studios says that there is some sort of problem where there is no overload availiable to match Rectangle.

 

Here is the Overloaded Draw function I am trying to use.

 

https://github.com/Microsoft/DirectXTK/blob/master/Inc/SpriteBatch.h#L68

 

 

 

Here is the rectangle struct definition from simple math.

https://github.com/Microsoft/DirectXTK/blob/master/Inc/SimpleMath.h#L47

Share this post


Link to post
Share on other sites
Advertisement

When posting an error, please post the code you're trying, and the associated error message + error code. Show, don't describe.

 

My guess is you have to use the operator cast overload and store in a temporary before using a pointer to that as a parameter of Draw.

 

 

EDIT: That is, something like this...

RECT sourceRect = static_cast<RECT> sourceRectangle;
Draw(texture, position, &sourceRect, ...);
Edited by Lactose!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement