From: gumartinm Date: Sun, 6 Nov 2011 23:24:20 +0000 (+0100) Subject: Cleaning up the code. Many, many things are left. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=db91656a3fba7d8b7f7cfc4b9f5a00801e441ab8;p=JavaForFun Cleaning up the code. Many, many things are left. Step by step I will get the goal, my first Tetris in Android :) --- diff --git a/AndroidTetris/src/de/android/androidtetris/DrawView.java b/AndroidTetris/src/de/android/androidtetris/DrawView.java index 97297d6..c51d0f2 100644 --- a/AndroidTetris/src/de/android/androidtetris/DrawView.java +++ b/AndroidTetris/src/de/android/androidtetris/DrawView.java @@ -34,38 +34,43 @@ public class DrawView extends SurfaceView { 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); + } + } + } } /** diff --git a/AndroidTetris/src/de/android/androidtetris/Piece.java b/AndroidTetris/src/de/android/androidtetris/Piece.java index a0c103a..a9c13f8 100644 --- a/AndroidTetris/src/de/android/androidtetris/Piece.java +++ b/AndroidTetris/src/de/android/androidtetris/Piece.java @@ -85,9 +85,9 @@ public enum Piece { }; - //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];