Piece prePiece;
Piece currentPiece;
- class AndroidTetrisThread extends Thread {
+ class AndroidTetrisThread extends Thread
+ {
private DrawView view;
- private boolean running = false;
+ private boolean running = false;
- public AndroidTetrisThread(DrawView view) {
- this.view = view;
- }
+
+ public AndroidTetrisThread(DrawView view) {
+ this.view = view;
+ }
- public void setRunning(boolean run) {
- running = run;
- }
+
+ public void setRunning(boolean run) {
+ running = run;
+ }
-
- @Override
- public void run() {
- while (running) {
- Canvas c = null;
- try {
- c = view.getHolder().lockCanvas();
- synchronized (view.getHolder()) {
- view.move(0, 1);
- view.drawMap(c);
- //view.onDraw(c);
- }
- } finally {
- if (c != null) {
- view.getHolder().unlockCanvasAndPost(c);
- }
- }
- }
- }
+
+ @Override
+ public void run()
+ {
+ while (running)
+ {
+ Canvas c = null;
+ try {
+ c = view.getHolder().lockCanvas();
+ synchronized (view.getHolder())
+ {
+ view.move(0, 1);
+ view.drawMap(c);
+ //view.onDraw(c);
+ }
+ }finally {
+ if (c != null)
+ view.getHolder().unlockCanvasAndPost(c);
+ }
+ }
+ }
}
/**
};
- //Every is contained in a square. This is the square's width.
+ //Every piece is contained in a square. This is the square's width.
private static final int WIDTH = 4;
- //Every is contained in a square. This is the square's height.
+ //Every piece is contained in a square. This is the square's height.
private static final int HEIGHT = 4;
//Every piece is contained in a square.
public Tile[][] size = new Tile[WIDTH][HEIGHT];