예제 #1
0
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   if (mDrawThread == null) {
     mDrawThread = new DrawThread(mHolder, getContext());
     mDrawThread.start();
   }
 }
예제 #2
0
 public void startAnimation() {
   if (dt == null) {
     Log.d(LOG_TAG, "startAnimation");
     dt = new DrawThread(this, getHolder());
     dt.start();
   }
 }
예제 #3
0
 public void surfaceCreated(SurfaceHolder holder) {
   if (!running) {
     running = true;
     thread.setMode(Mode.RUNNING);
     thread.start();
   } else {
     thread.resume();
   }
 }
예제 #4
0
 private void startAnimation() {
   isLoopDraw = true;
   isLoopCount = true;
   drawThread = new DrawThread();
   countThread = new CountThread();
   drawThread.start();
   countThread.start();
   Log.i(TAG, "satrtAnimation=" + anim);
 }
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   paint = new Paint(); // 创建画笔
   paint.setAntiAlias(true); // 打开抗锯齿
   // 加载图片资源
   bulletBmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.bullet);
   bgBmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.bg);
   explodeBmps =
       new Bitmap[] {
         BitmapFactory.decodeResource(this.getResources(), R.drawable.explode0),
         BitmapFactory.decodeResource(this.getResources(), R.drawable.explode1),
         BitmapFactory.decodeResource(this.getResources(), R.drawable.explode2),
         BitmapFactory.decodeResource(this.getResources(), R.drawable.explode3),
         BitmapFactory.decodeResource(this.getResources(), R.drawable.explode4),
         BitmapFactory.decodeResource(this.getResources(), R.drawable.explode5),
       };
   bullet = new Bullet(this, bulletBmp, explodeBmps, 0, 290, 1.3f, -5.9f); // 创建子弹对象
   drawThread = new DrawThread(this); // 创建绘制线程
   drawThread.start(); // 启动绘制线程
 }
예제 #6
0
 @Override
 public void surfaceCreated(SurfaceHolder arg0) {
   setKeepScreenOn(true);
   _thread.setRunning(true);
   _thread.start();
   // Start setting paints with anti alias and color
   whiteTextPaint.setColor(Color.WHITE);
   whiteTextPaint.setAntiAlias(true);
   whiteTextPaint.setTextSize(14);
   blackTextPaint.setColor(Color.BLACK);
   blackTextPaint.setAntiAlias(true);
   blackTextPaint.setTextSize(14);
   largeTextPaint.setColor(Color.WHITE);
   largeTextPaint.setAntiAlias(true);
   largeTextPaint.setTextSize(32);
   redTextPaint.setColor(Color.RED);
   redTextPaint.setAntiAlias(true);
   redTextPaint.setTextSize(18);
   ColorMatrix cm = new ColorMatrix(mx);
   invert.setColorFilter(new ColorMatrixColorFilter(cm));
   invert.setAntiAlias(true);
   // End settings paint
   // Set bitmap dimensions
   bulletW = bulletBitmap.getWidth();
   bulletH = bulletBitmap.getHeight();
   squareW = squareBitmap.getWidth();
   squareH = squareBitmap.getHeight();
   parabolicW = parabolicBitmap.getWidth();
   parabolicH = parabolicBitmap.getHeight();
   turningW = turningBitmap.getWidth();
   turningH = turningBitmap.getHeight();
   homingW = homingBitmap.getWidth();
   homingH = homingBitmap.getHeight();
   berzerkW = berzerkBitmap.getWidth();
   berzerkH = berzerkBitmap.getHeight();
   mcW = mcBitmap.getWidth();
   mcH = mcBitmap.getHeight();
   // End setting bitmap dimensions
 }
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   drawThread = new DrawThread(getHolder());
   drawThread.setRunning(true);
   drawThread.start();
 }
예제 #8
0
 public void surfaceCreated(SurfaceHolder holder) {
   if (!_run) {
     thread.setRunning(true);
     thread.start();
   }
 }