SFML community forums

Help => Graphics => Topic started by: Gauzr on June 06, 2015, 01:28:23 pm

Title: Can't get view to move
Post by: Gauzr on June 06, 2015, 01:28:23 pm
Sorry this is such a basic problem, but I can't seem to get the view in my game to move. I created the view and defined it, but when I move it in the game loop, nothing happens.



sf::RenderWindow window(sf::VideoMode(600, 600), "SFML");

sf::View view;
view.setSize(sf::Vector2f(600, 600));
view.setCenter(sf::Vector2f(300, 300));
                 
window.setView(view);


...

view.move(100, 0);
       


 
Title: Re: Can't get view to move
Post by: shadowmouse on June 06, 2015, 01:53:53 pm
When you call setView, it stores a copy of the view, not a reference or a pointer to the view. As such, you must call setView again after moving the view.
Title: Re: Can't get view to move
Post by: Gauzr on June 06, 2015, 02:05:11 pm
Ah of course, that makes sense - thanks