Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. public class GameView extends View {
  2. private Bitmap bmp1;
  3. private Bitmap bmp2;
  4. private Bitmap bmp3;
  5. private Bitmap bmp4;
  6. private Bitmap bmp5;
  7. private Bitmap bmp6;
  8. public GameView(Context context) {
  9. super(context);
  10.  
  11. bmp1 = BitmapFactory.decodeResource(getResources(),R.drawable.candy1);
  12. bmp2 = BitmapFactory.decodeResource(getResources(),R.drawable.candy2);
  13. bmp3 = BitmapFactory.decodeResource(getResources(),R.drawable.candy3);
  14. bmp4 = BitmapFactory.decodeResource(getResources(),R.drawable.candy4);
  15. bmp5 = BitmapFactory.decodeResource(getResources(),R.drawable.candy5);
  16. bmp6 = BitmapFactory.decodeResource(getResources(),R.drawable.candy6);
  17.  
  18. }
  19. @Override
  20. protected void onDraw(Canvas canvas){
  21. Bitmap[] images = {bmp1 , bmp2 , bmp3 , bmp4 , bmp5 , bmp6};
  22. canvas.drawColor(Color.WHITE);
  23. for (int i = 0; i<306; i+=61)
  24. {
  25. canvas.drawBitmap(bmp1, i, 0, null);
  26. canvas.drawBitmap(bmp2, i, 61, null);
  27. canvas.drawBitmap(bmp3, i, 122, null);
  28. canvas.drawBitmap(bmp4, i, 183, null);
  29. canvas.drawBitmap(bmp5, i, 244, null);
  30. canvas.drawBitmap(bmp6, i, 305, null);
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement