Game Development Reference
In-Depth Information
The process of setting the zoom itself is done either by calling View::zoom() with a
zoom factor, or by changing the size of the view with View::setSize() . As it is, with
View::rotate() and View::move() , View::zoom() is used mostly when we
want to have a continuous motion throughout a number of frames.
It is important to note that View does not store a zoom factor, but only the size of the
view. This means that calling View::zoom() with a factor different than 1 will changes
the view size each time, even if we pass the same factor. The method does not set the
zoom, it just modifies the size of the view by that factor. For example, if we call
View::zoom() twice with a factor of 1/2 , we will end up with:
(1/2) * (1/2) * size = (1/4) * size
We are effectively doing the same thing as calling View::zoom() with a factor of 1/4 .
Since View::zoom() takes just a factor, it uses the current view size to estimate how
much it has to modify both the width and height of the view. If we want to change the
width and height by two different factors, we have to use View::setSize() with our
own values of the width and height; here is an example:
Search WWH ::




Custom Search