In a feeble attempt to learn some Android development am I stuck at graphics. My aim here is pretty simple:
Take n small images and build a random image, larger than the screen with possibility to scroll around.
Have an animated object move around on it
I have looked at the SDK examples, Lunar Lander especially but there are a few things I utterly fail to wrap my head around. I've got a birds view plan (which in my head seems reasonably sane):
How do I merge the tiles into one large image?
The background is static so I figure I should do like this:
Make a 2d array with refs to the tiles
Make a large Drawable and draw the tiles on it
At init draw this big image as the background
At each onDraw redraw the background of the previous spot of the moving object, and the moving object at its new location
The problem is the hands on things. I load the small images with "Bitmap img1 = BitmapFactory.decodeResource (res, R.drawable.img1)", but then what? Should I make a canvas and draw the images on it with "canvas.drawBitmap (img1, x, y, null);"? If so how to get a Drawable/Bitmap from that?
I'm totally lost here, and would really appreciate some hands on help (I would of course be grateful for general hints as well, but I'm primarily trying to understand the Graphics objects). To make you, dear reader, see my level of confusion will I add my last desperate try:
Drawable drawable;
Canvas canvas = new Canvas ();
Bitmap img1 = BitmapFactory.decodeResource (res, R.drawable.img1); // 50 x 100 px image
Bitmap img2 = BitmapFactory.decodeResource (res, R.drawable.img2); // 50 x 100 px image
canvas.drawBitmap (img1, 0, 0, null);
canvas.drawBitmap (img2, 50, 0, null);
drawable.draw (canvas); // obviously wrong as draw == null
this.setBackground (drawable);
Thanks in advance