Hi all
and thank you for any help in advance.
I create my window and view as follows:
window(sf::VideoMode(l_videoMode.x, l_videoMode.y), l_windowName, sf::Style::Close | sf::Style::Resize)
m_View.setSize(sf::Vector2f(window.getSize().x, window.getSize().y));
m_View.setCenter(window.getSize().x/2, window.getSize().y/2);
In the Update method of my window class I get the mouse position as follows:
m_winMousePos = sf::Mouse::getPosition(window);
//I have also tried the following
/*
//sf::Vector2i pixelPos = sf::Mouse::getPosition(window);
//sf::Vector2f worldPos = window.mapPixelToCoords(pixelPos);
/*
//The window resize event as sfml website
if (event.type == sf::Event::Resized)
{
sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height);
window.setView(sf::View(visibleArea));
}
//My draw code:
void Window::Draw(const sf::Drawable& l_drawable)
{
window.setView(m_View);
window.draw(l_drawable);
}
When I maximise the window, the mouse coords are not correct and I cannot get what I am doing wrong.
Any pointers [no pun intended] would be a great help!