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

Author Topic: Trouble using Mouse::GetPosition() relative to the screen  (Read 1171 times)

0 Members and 1 Guest are viewing this topic.

Aether92

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Trouble using Mouse::GetPosition() relative to the screen
« on: October 23, 2013, 11:58:20 pm »
I'm trying to use pass by reference so I can get my mouse X and Y coordinates relative to the screen inside another class but I am having trouble doing so

what i have is
void MenuNav(sf::RenderWindow*) //in h file

//in the cpp i have
void HUD::MenuNav(sf::RenderWindow *Window)
{
      sf::Mouse::getPosition(Window).x;
}

but it seems to have a problem with that.
Error:no instance of overloaded function, I know that the problem is Window in the getPosition function but i cant figure out what is meant to go there.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Trouble using Mouse::GetPosition() relative to the screen
« Reply #1 on: October 24, 2013, 12:03:17 am »
It wants a window, not a pointer to a window, so just dereference the pointer.

This is basic C++.  You might want to go review a bit.

Aether92

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Trouble using Mouse::GetPosition() relative to the screen
« Reply #2 on: October 24, 2013, 12:09:28 am »
You're right, i don't know why I didn't think of this...just stuck in a complete mind blank -_-