Advertisement
Zidinjo

GameView

Oct 23rd, 2015
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1.  
  2.  
  3. import android.content.Context;
  4. import android.graphics.Canvas;
  5. import android.graphics.Color;
  6. import android.graphics.Paint;
  7. import android.os.CountDownTimer;
  8. import android.util.AttributeSet;
  9. import android.util.Log;
  10. import android.view.View;
  11.  
  12. /**
  13.  * Created by Zidinjo on 22.10.2015.
  14.  */
  15. public class GameView extends View {
  16.  
  17.     private Canvas canvas;
  18.     private Context context;
  19.     private Paint peter;
  20.     private GameObject ball;
  21.  
  22.     public GameView(Context context) {
  23.         super(context);
  24.         this.context = context;
  25.         initGame();
  26.     }
  27.  
  28.     public void initGame(){
  29.  
  30.  
  31.         //ball.setSprite(R.drawable.menu_background);
  32.     }
  33.  
  34.     public GameView(Context context, AttributeSet attrs) {
  35.         super(context, attrs);
  36.     }
  37.  
  38.     public GameView(Context context, AttributeSet attrs, int defStyleAttr) {
  39.         super(context, attrs, defStyleAttr);
  40.     }
  41.  
  42.     @Override
  43.     public void onDraw(Canvas canvas){
  44.         ball = new GameObject(this.context);
  45.         this.canvas = canvas;
  46.         peter = new Paint();
  47.         peter.setColor(Color.BLUE);
  48.         canvas.drawRect(100, 100, 200, 200, peter);
  49.         ball.render(canvas,peter);
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement