hi there, i have a few of 32x32 tiles in a bitmap array and i would
like to loop through them one by one and add them all together in 1
big image.
each new tile is supposed to be located next of the previous one in a
4x3 grid for example..
so i would like to do that:
(b1=bitmap1, b2=bitmap2...etc)
b1 b2 b3 b4
b5 b6 b7 b8
b9 b10 b11 b12
each time i have tryed to use createBitmap in a loop, the image was
overwritten,
so i alway ended up with 1 final image but only containing just one
32x32 tile instead of the 12 ones nicely displayed in a 4x3 grid..
------------
here's what i've done so far:
MapLoader.width equals 4
MapLoader.height equals 3
a is an int that return the tile number (from the sheet) at pos x and
y
so say, tiles[x][y] = 5 it mean the tile number 5 is supposed to be
drawn at location x,y
col and row are here to tell where on the sheet the tile 5 is
located...
for (int x = 0; x < MapLoader.width; x++) {
for (int y = 0; y < MapLoader.height; y++) {
a = MapLoader.tiles[x][y];
col = (int)Math.ceil(a/3);
row = a%3;
picTemp[counter] = Bitmap.createBitmap(sheet, col*32, row*32, 32,
32);
counter++;
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en