C++ DirectxTK Spritebatch.Draw problem

Started by
0 comments, last by Lactose 7 years, 5 months ago

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

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, ...);

Hello to all my stalkers.

This topic is closed to new replies.

Advertisement