Stitching a background together
Although AndEngine's Scene
object allows us to set a background for the scene, this is not always a viable solution for our projects. In order to allow panning and zooming of the background, we can stitch together multiple texture regions and apply them directly to the scene as sprites. This topic is going to cover stitching two 800 x 480 texture regions together in order to create a larger pan-able and zoom-able background. The idea behind background stitching is to allow for portions of a scene to be displayed in smaller chunks. This gives us the opportunity to create smaller texture sizes as to not exceed the 1024 x 1024 maximum texture size for most devices. Additionally, we can enable culling so that segments of the scene are not drawn when they aren't displayed onscreen in order to improve performance. See the following figure for a look at the results:
Getting started...
Perform the recipe, Pinch-zoom camera functionality, which is given in this chapter...