Closed bitbrain closed 4 years ago
We currently can set the camera zoom via defaultZoomFacor property. However, this is very bad for various reasons:
defaultZoomFacor
Change the zoom API to the following:
setZoom(0.2f, ZoomMode.TO_VALUE); setZoom(256f, ZoomMode.TO_WIDTH); setZoom(128f, ZoomMode.TO_HEIGHT);
(by default, setZoom will use TO_VALUE)
setZoom
TO_VALUE
TO_WIDTH
TO_HEIGHT
http://acamara.es/blog/2012/02/keep-screen-aspect-ratio-with-different-resolutions-using-libgdx/
Motivation
We currently can set the camera zoom via
defaultZoomFacor
property. However, this is very bad for various reasons:Solution
Change the zoom API to the following:
(by default,
setZoom
will useTO_VALUE
)TO_VALUE
the zoom value provided is being used as camera zoomTO_WIDTH
the zoom value is being calculated dynamically based on the current camera widthTO_HEIGHT
the zoom value is being calculated dynamically based on the current camera height