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

Author Topic: Setting a view's position?  (Read 1496 times)

0 Members and 1 Guest are viewing this topic.

Bones

  • Newbie
  • *
  • Posts: 24
    • View Profile
Setting a view's position?
« on: January 17, 2012, 04:19:18 am »
Is there a way that I could change a view's position without using .Move()?  I'd like to directly just set the position(in world coordinates) if that's possible.  Perhaps I'm missing some obvious reason why this can't be done though.

Thanks.

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: Setting a view's position?
« Reply #1 on: January 17, 2012, 05:15:09 am »
Correct me if I'm wrong here, but would SetCenter work to change the positon? I've never used sf::View yet but looking at the sf::View source this is how the Move method operates.

Code: [Select]

void View::Move(float offsetX, float offsetY)
{
    SetCenter(myCenter.x + offsetX, myCenter.y + offsetY);
}
CoderZilla - Everything Programming

Bones

  • Newbie
  • *
  • Posts: 24
    • View Profile
Setting a view's position?
« Reply #2 on: January 17, 2012, 05:26:04 am »
Hey thanks, I'll try that!

EDIT: Tested, it works just as intended.

 

anything