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

Author Topic: Error expected a member name  (Read 1220 times)

0 Members and 1 Guest are viewing this topic.

sfml4Gamedev

  • Newbie
  • *
  • Posts: 2
    • View Profile
Error expected a member name
« on: November 02, 2016, 06:17:43 pm »
void Button::checkClick(sf::Vector2f mousePos) {
   this->&getSprite().getGlobalBounds().contains(mousePos); /*error here I can't deference the pointer to my sprite to call this function*/
}

//currentSpr is a pointer to the current sprite being used by my button
sf::Sprite* Button::getSprite() {
   return currentSpr;
}

My question is how can I implement my check click function / how can I fix this error

sfml4Gamedev

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Error expected a member name
« Reply #1 on: November 02, 2016, 08:04:04 pm »
I fixed this, I needed to call the objects function using -> since it's a pointer

ex)
   this->getSprite()->getGlobalBounds().contains(mousePos);