]> cvs.zerfleddert.de Git - FreeShisen/blobdiff - src/de/cwde/shisensho/ShisenShoView.java
huh?
[FreeShisen] / src / de / cwde / shisensho / ShisenShoView.java
index cb1a57c17ad0421e202c12f6bfd2822f9db2af2b..9872c6644654d91fa868035e15c5d04dc7d7b913 100644 (file)
@@ -5,14 +5,13 @@ import java.util.Locale;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import de.cwde.shisensho.R;
-
 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Color;
+import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Paint.Align;
 import android.graphics.Paint.Cap;
@@ -64,6 +63,11 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                surfaceHolder.addCallback(this);
        }
 
+       public ShisenShoView(Context ctx) {
+               super((Context)ctx);
+               // silence lint?
+       }
+
        private void paint(StatePaint pstate) {
                this.pstate=pstate;
                repaint();
@@ -85,10 +89,17 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                tileWidth = tileset.getWidth()/tilesetCols;
                tileHeight = tileset.getHeight()/tilesetRows;
                tile = new Bitmap[tilesetRows*tilesetCols];
+               
+               // align to screen
+               Matrix matrix = new Matrix();
+               matrix.setScale(1.0f, 1.0f); // FIXME!
+               
+               // TODO: go on.
+               
                int k=0;
                for (int i=0; i<tilesetRows; i++) {
                        for (int j=0; j<tilesetCols; j++) {
-                               tile[k] = Bitmap.createBitmap(tileset, j*tileWidth, i*tileHeight, tileWidth, tileHeight, null, false);
+                               tile[k] = Bitmap.createBitmap(tileset, j*tileWidth, i*tileHeight, tileWidth, tileHeight, matrix, false);
                                tile[k].setDensity(Bitmap.DENSITY_NONE);
                                k++;
                        }
@@ -148,9 +159,9 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
 
        private void initializeGame() {
                loadBackground();
-               loadTileset();
                screenWidth=getWidth();
                screenHeight=getHeight();
+               loadTileset();
                //undo.sensitive=false;
                pstate=StatePaint.BOARD;
                app.newPlay();
@@ -229,6 +240,7 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
            }
        }
 
+       @SuppressWarnings("deprecation")
        public void drawMessage(Canvas canvas, int x, int y, boolean centered, String message, String color, float textSize)  {
                Paint paint = new Paint();
                paint.setColor(Color.parseColor(color));
@@ -659,4 +671,4 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                paint.setFlags(Paint.ANTI_ALIAS_FLAG);
        }
 */
-}
\ No newline at end of file
+}
Impressum, Datenschutz