I'm making a buttonClick() function in a different class, I need to pass the window and event into the function from the main(), but when I try to get the position of the mouse in the window passed in the function, it gives me a error: no instance overloaded function sf::Mouse.getPosition matches the argument list, I have no idea what's going on, any help?
here is the code:
void screenManager::buttonClick(RenderTarget &window, Event &event) {
if (mouse.getPosition(window).x > startButtonText.getGlobalBounds().left && mouse.getPosition(window).x < startButtonText.getGlobalBounds().left + startButtonText.getGlobalBounds().width && mouse.getPosition(window).y > startButtonText.getGlobalBounds().top && mouse.getPosition(window).y < startButtonText.getGlobalBounds().top + startButtonText.getGlobalBounds().width - 250) {
startButtonText.setColor(Color::White);
}
else {
startButtonText.setColor(Color::Green);
}
if (mouse.getPosition(window).x > startButtonText.getGlobalBounds().left && mouse.getPosition(window).x < startButtonText.getGlobalBounds().left + startButtonText.getGlobalBounds().width && mouse.getPosition(window).y > startButtonText.getGlobalBounds().top && mouse.getPosition(window).y < startButtonText.getGlobalBounds().top + startButtonText.getGlobalBounds().width - 250 && event.type == Event::MouseButtonPressed && event.key.code == Mouse::Left) {
display = false;
}