Changeset b6a9b5f in galcon-client for src/com/example/helloandroid/GameView.java
- Timestamp:
- May 28, 2010, 4:02:05 AM (15 years ago)
- Branches:
- master
- Children:
- 5053d90
- Parents:
- 5a03a06
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/helloandroid/GameView.java
r5a03a06 rb6a9b5f 202 202 mTextPaint = new Paint(); 203 203 mTextPaint.setAntiAlias(true); 204 mTextPaint.setARGB(255, 255, 0, 0);204 mTextPaint.setARGB(255, 255, 255, 255); 205 205 206 206 mWinsInARow = 0; … … 310 310 public void run() { 311 311 while (mRun) { 312 //Log.i("Gencon", "run called"); 313 312 314 Canvas c = null; 313 315 try { 314 316 c = mSurfaceHolder.lockCanvas(null); 315 317 synchronized (mSurfaceHolder) { 318 //Log.i("Gencon", "about to call stuff: mode is "+mMode); 319 316 320 if (mMode == STATE_RUNNING) updatePhysics(); 317 321 doDraw(c); … … 418 422 * thread, which updates the user-text View. 419 423 */ 420 boolean test = true;421 if(test)422 return;423 424 synchronized (mSurfaceHolder) { 424 425 mMode = mode; … … 470 471 mCanvasHeight = height; 471 472 472 Log.i( this.getClass().getName(), "width: "+mCanvasWidth+", height: "+mCanvasHeight);473 Log.i("Gencon", "width: "+mCanvasWidth+", height: "+mCanvasHeight); 473 474 474 475 Random rand = new Random(); 475 476 476 for(int x=0; x<1 0; x++) {477 for(int x=0; x<15; x++) { 477 478 Planet p = new Planet(rand.nextInt(45)+5, rand.nextInt(mCanvasWidth), rand.nextInt(mCanvasHeight)); 478 p.setNumShips(rand.nextInt(150));479 479 480 480 if(Planet.collisionDetected(p, planets)) { … … 484 484 x--; 485 485 }else { 486 p.setNumShips(rand.nextInt(150)); 487 p.setFaction(rand.nextInt(5)); 486 488 planets.add(p); 487 489 } … … 569 571 // Draw the background image. Operations on the Canvas accumulate 570 572 // so this is like clearing the screen. 571 canvas.drawBitmap(mBackgroundImage, 0, 0, null);572 573 574 //Log.i("Gencon", "doDraw called"); 575 576 canvas.drawBitmap(mBackgroundImage, 0, 0, null); 573 577 for(Planet p : planets) { 574 canvas.drawCircle(p.getX(), p.getY(), p.getRadius(), mLinePaint); 575 canvas.drawText(Integer.toString(p.getNumShips()), p.getX(), p.getY(), mTextPaint); 578 p.draw(canvas, mLinePaint, mTextPaint); 576 579 } 577 580 … … 601 604 */ 602 605 private void updatePhysics() { 606 //Log.i("Gencon", "updatePhysics called"); 607 603 608 long now = System.currentTimeMillis(); 604 609 … … 702 707 } 703 708 704 setState(result, message);709 //setState(result, message); 705 710 } 706 711 }
Note:
See TracChangeset
for help on using the changeset viewer.