Revisão 16
New grid layout
| Battlefield.pde | ||
|---|---|---|
| 8 | 8 |
|
| 9 | 9 |
class Battlefield |
| 10 | 10 |
{
|
| 11 |
int videoScale = 80;
|
|
| 12 |
int width = 1280;
|
|
| 13 |
int height = 720;
|
|
| 11 |
int videoScale = 64;
|
|
| 12 |
int width; |
|
| 13 |
int height; |
|
| 14 | 14 |
|
| 15 | 15 |
int blacks = 0; |
| 16 | 16 |
int whites = 0; |
| ... | ... | |
| 22 | 22 |
|
| 23 | 23 |
Battlefield (int w, int h) |
| 24 | 24 |
{
|
| 25 |
this.width = 1280;
|
|
| 26 |
this.height = 720;
|
|
| 25 |
this.width = w;
|
|
| 26 |
this.height = h;
|
|
| 27 | 27 |
|
| 28 | 28 |
println ("Battlefield " + this.width + "x" + this.height + " created");
|
| 29 | 29 |
} |
| ... | ... | |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
void draw() {
|
| 38 |
background(159, 182, 205); |
|
| 38 |
// background(159, 182, 205); |
|
| 39 |
background(100); |
|
| 39 | 40 |
|
| 40 | 41 |
this.blacks = 0; |
| 41 | 42 |
this.whites = 0; |
| ... | ... | |
| 43 | 44 |
for (int i = 0; i < this.cells.length; i++) {
|
| 44 | 45 |
//rows |
| 45 | 46 |
for (int j = 0; j < this.cells[i].length; j++) {
|
| 46 |
this.cells [i][j].setup ( this.cells[i][j].lifeBar, this.cells[i][j].animating ); |
|
| 47 |
this.cells [i][j].setup ( this.cells[i][j].lifeBar, this.cells[i][j].animating, this.videoScale );
|
|
| 47 | 48 |
this.cells [i][j].draw(); |
| 48 | 49 |
|
| 49 | 50 |
if (this.cells [i][j].isWhite ()) |
Também disponível em: Unified diff