| OLD | NEW |
| 1 part of game; | 1 part of game; |
| 2 | 2 |
| 3 const double _steeringThreshold = 0.0; | 3 const double _steeringThreshold = 0.0; |
| 4 const double _steeringMax = 150.0; | 4 const double _steeringMax = 150.0; |
| 5 | 5 |
| 6 // Random generator | 6 // Random generator |
| 7 Math.Random _rand = new Math.Random(); | 7 Math.Random _rand = new Math.Random(); |
| 8 | 8 |
| 9 const double _gameSizeWidth = 1024.0; | 9 const double _gameSizeWidth = 1024.0; |
| 10 const double _gameSizeHeight = 1024.0; | 10 const double _gameSizeHeight = 1024.0; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 _starScales = []; | 365 _starScales = []; |
| 366 _opacity = []; | 366 _opacity = []; |
| 367 | 367 |
| 368 for (int i = 0; i < _numStars; i++) { | 368 for (int i = 0; i < _numStars; i++) { |
| 369 _starPositions.add(new Point(_rand.nextDouble() * _gameSizeWidth, _rand.ne
xtDouble() * _gameSizeHeight)); | 369 _starPositions.add(new Point(_rand.nextDouble() * _gameSizeWidth, _rand.ne
xtDouble() * _gameSizeHeight)); |
| 370 _starScales.add(_rand.nextDouble()); | 370 _starScales.add(_rand.nextDouble()); |
| 371 _opacity.add(_rand.nextDouble() * 0.5 + 0.5); | 371 _opacity.add(_rand.nextDouble() * 0.5 + 0.5); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 void paint(RenderCanvas canvas) { | 375 void paint(PaintingCanvas canvas) { |
| 376 // Setup paint object for opacity and transfer mode | 376 // Setup paint object for opacity and transfer mode |
| 377 Paint paint = new Paint(); | 377 Paint paint = new Paint(); |
| 378 paint.setTransferMode(TransferMode.plus); | 378 paint.setTransferMode(TransferMode.plus); |
| 379 | 379 |
| 380 double baseScaleX = 32.0 / _img.size.width; | 380 double baseScaleX = 32.0 / _img.size.width; |
| 381 double baseScaleY = 32.0 / _img.size.height; | 381 double baseScaleY = 32.0 / _img.size.height; |
| 382 | 382 |
| 383 // Draw each star | 383 // Draw each star |
| 384 for (int i = 0; i < _numStars; i++) { | 384 for (int i = 0; i < _numStars; i++) { |
| 385 Point pos = _starPositions[i]; | 385 Point pos = _starPositions[i]; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 double dy = a.y - b.y; | 454 double dy = a.y - b.y; |
| 455 if (dx < 0.0) dx = -dx; | 455 if (dx < 0.0) dx = -dx; |
| 456 if (dy < 0.0) dy = -dy; | 456 if (dy < 0.0) dy = -dy; |
| 457 if (dx > dy) { | 457 if (dx > dy) { |
| 458 return dx + dy/2.0; | 458 return dx + dy/2.0; |
| 459 } | 459 } |
| 460 else { | 460 else { |
| 461 return dy + dx/2.0; | 461 return dy + dx/2.0; |
| 462 } | 462 } |
| 463 } | 463 } |
| OLD | NEW |