Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on the mouse input #352

Closed
dudedude1234 opened this issue Jan 24, 2023 · 1 comment
Closed

Error on the mouse input #352

dudedude1234 opened this issue Jan 24, 2023 · 1 comment
Labels

Comments

@dudedude1234
Copy link

Im having a problem with this method

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

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


    if (rect(state.positionMode()))
        return true;


    //Otherwise, don't do anything
    return false;

}

The "rect" and "state" method on this

    if (rect(state.positionMode()))
        return true;

keeps putting out this

E0109	expression preceding parentheses of apparent call must have (pointer-to-) function type	
@walbourn
Copy link
Member

The output of the Error Window can be confusing, so I recommend looking at the actual compiler output in the Build window instead for details.

That said, this does not look like valid C++ code:

    if (rect(state.positionMode()))
        return true;

rect is a RECT struct and doesn't have an operator().

The error is probably because this syntax state.positionMode() is trying to treat the simple value of state.positionMode as a function pointer. It isn't a method, so you'd just use state.positionMode.

As with previous questions, you'd be well served to spend some time reading over a basic C/C++ programming tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants