microsoft/DirectXTK

UI error

dudedude1234 opened this issue · 1 comments

Im setting up the mouse input for the menu

`
bool StartScreen::isTextClicked()
{
auto state = m_mouse->Get().GetState();

RECT rect(state.x, state.y, m_fontPos.x, m_fontPos.y);



return rect(state.x, state.y, m_fontPos.x, m_fontPos.y);

}
`

I got this error:

Severity Code Description Project File Line Suppression State
Error (active) E0289 no instance of constructor "tagRECT::tagRECT" matches the argument list

RECT doesn't have a ctor. It's just a generic struct defined in windef.h:

typedef struct tagRECT
{
    LONG    left;
    LONG    top;
    LONG    right;
    LONG    bottom;
} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;

There is a D3D11_RECT that is derived that RECT that adds a ctor unless you are building with D3D11_NO_HELPERS.

See https://github.com/microsoft/DirectXTK/wiki/DirectXHelpers

You can use C++11 uniform initialization with the base RECT as follows:

RECT rect = { state.x, state.y, m_fontPos.x, m_fontPos.y };

That said, it's most likely that your font positions are float so you'll get conversion warnings unless you cast them:

RECT rect = {  state.x, state.y, static_cast<long>(m_fontPos.x), static_cast<long>(m_fontPos.y) };