SFML community forums

Help => General => Topic started by: Aether92 on October 23, 2013, 11:58:20 pm

Title: Trouble using Mouse::GetPosition() relative to the screen
Post by: Aether92 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.
Title: Re: Trouble using Mouse::GetPosition() relative to the screen
Post by: Ixrec 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.
Title: Re: Trouble using Mouse::GetPosition() relative to the screen
Post by: Aether92 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 -_-