I have the following Code snippet:
case sf::Event::Resized:
{
window->GetDefaultView ().SetSize (event.Size.Width, event.Size.Height);
break;
}
case sf::Event::MouseWheelMoved:
{
// When zooming in, center view on Mouse Cursor Position
if (event.MouseWheel.Delta > 0)
{
window->GetDefaultView ().SetCenter (window->ConvertCoords (window->GetInput ().GetMouseX (), window->GetInput ().GetMouseY ()));
window->SetCursorPosition (window->GetWidth () / 2, window->GetHeight () / 2);
}
window->GetDefaultView ().Zoom (event.MouseWheel.Delta < 0 ? 0.5f : 2.f);
break;
}
And get the following errors for it:
GUI.cc:79:87: error: passing ‘const sf::View’ as ‘this’ argument of ‘void sf::View::SetSize(float, float)’ discards qualifiers [-fpermissive]
GUI.cc:88:148: error: passing ‘const sf::View’ as ‘this’ argument of ‘void sf::View::SetCenter(const Vector2f&)’ discards qualifiers [-fpermissive]
GUI.cc:91:88: error: passing ‘const sf::View’ as ‘this’ argument of ‘void sf::View::Zoom(float)’ discards qualifiers [-fpermissive]
That did work in SFML1.6. I think the problem is, that RenderWindow::GetDefaultView () became const in SFML2.
Now i would like to know why and maybe a suggestion, how to archieve what i want.