Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Function argumet.  (Read 1499 times)

0 Members and 1 Guest are viewing this topic.

MrMou6

  • Newbie
  • *
  • Posts: 17
    • View Profile
Function argumet.
« 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:


So, what is worng with my "sf::RenderWindow" variable like argument? :D

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Function argumet.
« Reply #1 on: September 18, 2017, 12:40:54 am »
A render window cannot be copied.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

MrMou6

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Function argumet.
« Reply #2 on: September 18, 2017, 12:44:40 am »
So its not possible to check that is mouse on button or not?

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Function argumet.
« Reply #3 on: September 18, 2017, 12:45:15 am »
Pass it by reference instead.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything