Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.content.Context;
- import android.graphics.Canvas;
- import android.graphics.Color;
- import android.graphics.Paint;
- import android.os.CountDownTimer;
- import android.util.AttributeSet;
- import android.util.Log;
- import android.view.View;
- /**
- * Created by Zidinjo on 22.10.2015.
- */
- public class GameView extends View {
- private Canvas canvas;
- private Context context;
- private Paint peter;
- private GameObject ball;
- public GameView(Context context) {
- super(context);
- this.context = context;
- initGame();
- }
- public void initGame(){
- //ball.setSprite(R.drawable.menu_background);
- }
- public GameView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
- public GameView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
- @Override
- public void onDraw(Canvas canvas){
- ball = new GameObject(this.context);
- this.canvas = canvas;
- peter = new Paint();
- peter.setColor(Color.BLUE);
- canvas.drawRect(100, 100, 200, 200, peter);
- ball.render(canvas,peter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement