I just updated my SFML from SVN sources, I had a version from April 05th before (which is before the API change in sf::View).
I had to change my view setup from view.Rect = ... to view.SetCenter / view.SetHalfSize to make it compile. And then, all my SFML sprites and text are gone.
I was gonna scream in this forum, but after some trials, I found if I submitted my View each frame, instead of once, I saw the sprites behind my OpenGL stuff. So I was starting to blame RenderWindow for losing its view, and SFML for losing its Z.
Then, I found my mistake. The method RenderWindow::SetView was previously SetView(View *view), and now SetView(const View &view).
Previous (working) code:
void Game::SetupStuff()
{
sf::View view;
view.Rect = sf::FloatRect(0, 0, viewWidth, viewHeight);
m_RenderWindow->SetView(&view);
}
New (working) code:
void Game::SetupStuff()
{
const sf::FloatRect rect(0, 0, viewWidth, viewHeight);
sf::View *view = new sf::View(rect);
m_RenderWindow->SetView(*view);
}
I should change it to avoid allocation by having Game hold a sf::View member, but that's the idea: you have to keep the View instance somewhere,
do not use a local variable.
Hope this helps someone
Oh, and is there a reason not to provide a View::SetRect(const FloatRect &newRect) method? That would be nice for me, as 1) I compute width and height and not halves 2) my view starts at 0, 0 and finish at width, height, 3) that would make the setup one single call, best readability
.