0

i am making a game for android and currently scroll the map tile by tile, which is not very smooth when the map is made up of 500 tiles. I am loading the tiles based on a text file with letters etc and storing multiple Bitmaps in a ArrayList.

My question: is there any way that i can load all the bitmap tiles on the arraylist to a single Bitmap so that i can draw the single bitmap at one X,Y coordinate?

Thanks.

user1776707
  • 23
  • 1
  • 7
  • You can do that by painting multiple bitmaps into a larger canvas. However, the big problem with creating larger images is the limited memory and if you take a look at google maps which is based on gigabytes of image tiles, you can see that you can make it smooth. It's imo better to try to fix your tile rendering than to replace that problem with memory problems – zapl Aug 25 '13 at 09:04
  • all the bitmaps are painted onto a canvas but to update their position i need to do it tile by tile - meaning i need to loop through each bitmap and change its position. is their a way i can create one bitmap from the canvas with bitmaps drawn onto it so i can change that bitmaps position instead of filtering through lots of bitmaps and changing position one by one? – user1776707 Aug 25 '13 at 09:13
  • http://stackoverflow.com/questions/4013725/converting-a-canvas-into-bitmap-image-in-android – zapl Aug 25 '13 at 10:17
  • I assume you are using a `SurfaceView` - if not, look into using one. There is also `BitmapRegionDecoder` which can cut out a small section of a large bitmap quickly - may be better than loading 500 tiles. Quick search on SO and Google both returns lots of hits. – Tigger Aug 25 '13 at 11:28

0 Answers0