Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GameView extends View {
- private Bitmap bmp1;
- private Bitmap bmp2;
- private Bitmap bmp3;
- private Bitmap bmp4;
- private Bitmap bmp5;
- private Bitmap bmp6;
- public GameView(Context context) {
- super(context);
- bmp1 = BitmapFactory.decodeResource(getResources(),R.drawable.candy1);
- bmp2 = BitmapFactory.decodeResource(getResources(),R.drawable.candy2);
- bmp3 = BitmapFactory.decodeResource(getResources(),R.drawable.candy3);
- bmp4 = BitmapFactory.decodeResource(getResources(),R.drawable.candy4);
- bmp5 = BitmapFactory.decodeResource(getResources(),R.drawable.candy5);
- bmp6 = BitmapFactory.decodeResource(getResources(),R.drawable.candy6);
- }
- @Override
- protected void onDraw(Canvas canvas){
- Bitmap[] images = {bmp1 , bmp2 , bmp3 , bmp4 , bmp5 , bmp6};
- canvas.drawColor(Color.WHITE);
- for (int i = 0; i<306; i+=61)
- {
- canvas.drawBitmap(bmp1, i, 0, null);
- canvas.drawBitmap(bmp2, i, 61, null);
- canvas.drawBitmap(bmp3, i, 122, null);
- canvas.drawBitmap(bmp4, i, 183, null);
- canvas.drawBitmap(bmp5, i, 244, null);
- canvas.drawBitmap(bmp6, i, 305, null);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement