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

Author Topic: Reset view zoom?  (Read 2585 times)

0 Members and 1 Guest are viewing this topic.

cheeseboy

  • Newbie
  • *
  • Posts: 36
    • View Profile
Reset view zoom?
« on: December 25, 2014, 02:22:08 pm »
How do I reset a view that I've called zoom() on to a zoom factor of 100%  without altering it's position?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Reset view zoom?
« Reply #1 on: December 25, 2014, 03:06:18 pm »
Call zoom() again with the inverse of whatever number you passed it the first time?

By the way, I don't think there is such a thing as a "zoom factor of 100%" in SFML.  All zoom() does is multiply the view's size by whatever you pass it.

cheeseboy

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Reset view zoom?
« Reply #2 on: December 25, 2014, 03:12:22 pm »
I'm looking for a way to do it without storing a zoom factor. There doesn't seem to be much in terms of get functions related to zoom though...

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Reset view zoom?
« Reply #3 on: December 25, 2014, 03:17:33 pm »
That's because there is no "zoom" to get.  v.zoom(x); is essentially just v.setSize(x * v.getSize());

Since the view has a getSize() function, you shouldn't need to store anything yourself (except perhaps something that defines what "100% zoom" means for your program).
« Last Edit: December 25, 2014, 03:20:17 pm by Ixrec »