package com.ready.rain.graphics;

import java.util.Random;

public class Screen {

	private int width, height;
	public int[] pixels;
	public final int MAP_SIZE = 64;
	public final int MAP_SIZE_MASK = MAP_SIZE - 1;
	
	public int [] tiles = new int [MAP_SIZE *MAP_SIZE];
	
	private Random random = new Random () ;
	
	public Screen (int width, int height) {
		this.width = width;
		this.height = height;
		pixels = new int [width * height];
		
		for (int i = 0; i < MAP_SIZE * MAP_SIZE; i++ ) {
			tiles[i] = random.nextInt(0xffffff) ;
			tiles [0] = 0;
		}
		
		}
	
	public void clear () {
		for (int i = 0; i < pixels.length; i++) {
			pixels[i] = 0;
		}
	}
	
	public void render (int xOffset, int yOffset) {
		for (int y = 0; y < height; y++ ) {
			int yy = y + yOffset;
		if (yy < 0 || yy >= height) break;
			for (int x = 0; x < width; x++) {
				int xx = x + xOffset ;
			if (xx < 0 || xx >= width) break;
				pixels [x + y * width] = Sprite.grass.pixels [(x & 15) + (y & 15) * Sprite.grass.SIZE];
			}
				
		}
	
	}
		
}

@@ -732,25 +732,24 @@
 eight; y++ )
- 
 %7B%0A%09%09%09int yy 
@@ -746,17 +746,17 @@
 %09%09%09int y
-y
+p
  = y + y
@@ -769,14 +769,15 @@
 ;%0A%09%09
+%09
 if (y
-y
+p
  %3C 0
@@ -781,17 +781,17 @@
 %3C 0 %7C%7C y
-y
+p
  %3E= heig
@@ -794,21 +794,24 @@
 height) 
-break
+continue
 ;%0A%09%09%09for
@@ -850,17 +850,17 @@
 %09%09%09int x
-x
+p
  = x + x
@@ -869,19 +869,19 @@
 fset
- 
 ;%0A
+%09
 %09%09%09if (x
 x %3C 
@@ -876,17 +876,17 @@
 %09%09%09if (x
-x
+p
  %3C 0 %7C%7C 
@@ -886,17 +886,17 @@
 %3C 0 %7C%7C x
-x
+p
  %3E= widt
@@ -902,13 +902,16 @@
 th) 
-break
+continue
 ;%0A%09%09
@@ -921,20 +921,22 @@
 ixels %5Bx
+p
  + y
+p
  * width

Update Screen.java