SFML community forums

Help => General => Topic started by: MrMou6 on September 18, 2017, 12:33:01 am

Title: Function argumet.
Post by: MrMou6 on September 18, 2017, 12:33:01 am
Hello I tried to do a function:
bool MouseOnButton(sf::RenderWindow windowName, int minX, int maxX, int minY, int maxY) {
        if (sf::Mouse::getPosition(windowName).x > minX && sf::Mouse::getPosition(windowName).x < maxX &&
                sf::Mouse::getPosition(windowName).y > minY && sf::Mouse::getPosition(windowName).y < maxY)
                return true;
        else return false;
}
and when Im trying to check it:
(https://i.imgur.com/JvXfBVf.png)

So, what is worng with my "sf::RenderWindow" variable like argument? :D
Title: Re: Function argumet.
Post by: Hapax on September 18, 2017, 12:40:54 am
A render window cannot be copied.
Title: Re: Function argumet.
Post by: MrMou6 on September 18, 2017, 12:44:40 am
So its not possible to check that is mouse on button or not?
Title: Re: Function argumet.
Post by: Hapax on September 18, 2017, 12:45:15 am
Pass it by reference instead.