Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.0 sf::View::Move not accepting parameters  (Read 2302 times)

0 Members and 1 Guest are viewing this topic.

NobodyNothing

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 sf::View::Move not accepting parameters
« on: February 13, 2012, 07:02:11 pm »
Hello all!

I just downloaded and built the latest version of SFML 2.0 this morning (Version - 196-ge3d75f6) on 32bit Windows XP, and now sf::View::Move is not accepting an sf::Vector2f. Below is the offending code, where window is a sf::RenderWindow, and viewMoveSpeed and tileSize are ints:

Code: [Select]

sf::Vector2f offset(0, (viewMoveSpeed * tileSize));
window->GetDefaultView().Move(offset);


Am I missing something here, or could this be a recently introduced bug?

Thanks for you time!  :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 sf::View::Move not accepting parameters
« Reply #1 on: February 13, 2012, 07:10:23 pm »
Look at the error and the documentation: GetDefaultView() now returns a const reference.
Views are now handled by value, not by reference. So you must copy the current view, move it, and set it back.
Code: [Select]
sf::View view = window->GetDefaultView();
view.Move(offset);
window->SetView(view);
Laurent Gomila - SFML developer

NobodyNothing

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML 2.0 sf::View::Move not accepting parameters
« Reply #2 on: February 13, 2012, 07:26:57 pm »
Ah, ok, thanks for the fast reply! It's working great now. By the way, I wanted to say thanks for all your hard work on SFML, it's a great library, keep up the good work :D