// Path: core/src/main/java/net/panuska/tlappy/awt/BufferedImage.java
// public class BufferedImage {
//     private Bitmap b;
//     private Graphics g;
//     public static final int TYPE_INT_RGB = Bitmap.Config.ARGB_8888.ordinal();
// 
//     public BufferedImage(BitmapDrawable d) {
//         Bitmap immb = d.getBitmap();
//         b = immb.copy(Bitmap.Config.ARGB_8888, false);
//     }
// 
//     public BufferedImage(int width,
//                          int height,
//                          int imageType) {
//         b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
//         g = new Graphics(b);
//     }
// 
//     private BufferedImage(Bitmap b) {
//         this.b = b;
//     }
// 
//     public Graphics getGraphics() {
//         return g;
//     }
// 
//     public Bitmap getBitmap() {
//         return b;
//     }
// 
//     public BufferedImage getSubimage (int x, int y, int w, int h) {
//         Bitmap b = Bitmap.createBitmap(this.b, x, y, w, h);
//         return new BufferedImage(b);
//     }
// 
//     /**
//      * Returns a copy of this image rotated by 90 degrees.
//      * @return
//      */
//     public BufferedImage getRotatedImage() {
//         Matrix matrix = new Matrix();
//         matrix.postRotate(90);
//         Bitmap b = Bitmap.createBitmap(this.getBitmap(), 0, 0, this.getWidth(), this.getHeight(),  matrix, false);
//         return new BufferedImage(b);
//     }
// 
//     /**
//      * Returns a copy of this image mirrored by vertical axis
//      * @return
//      */
//     public BufferedImage getMirroredImage() {
//         Matrix matrix = new Matrix();
//         matrix.preScale(-1, 1);
//         Bitmap b = Bitmap.createBitmap(this.getBitmap(), 0, 0, this.getWidth(), this.getHeight(),  matrix, false);
//         return new BufferedImage(b);
//     }
// 
//     /**
//      * Returns 16x16 subimage starting at x, y
//      * @param x
//      * @param y
//      * @return
//      */
//     public BufferedImage getSubimage (int x, int y) {
//         return getSubimage(x, y, 16, 16);
//     }
// 
//     public int getWidth() {
//         return b.getWidth();
//     }
// 
//     public int getHeight() {
//         return b.getHeight();
//     }
// }
// 
// Path: core/src/main/java/net/panuska/tlappy/Device.java
// public class Device {
//     private static final String TAG = Device.class.getSimpleName();
//     public static Keyboard keyboard;
//     public static VRAM vram;
//     public static Music music;
// 
//     public static int displayWidth;
//     public static int displayHeight;
// 
//     public static boolean initialized = false;
//     public static void init (SurfaceView view) {
//         if (initialized) {
//             Log.d(TAG, "Device already initialized");
//             return;
//         }
//         Log.d(TAG, "Init");
//         Images.load(view.getResources());
//         keyboard = Keyboard.getInstance();
//         vram = VRAM.getInstance();
//         vram.createWindow(view);
//         music = Music.getInstance(view.getContext());
//         WindowManager wm = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE);
//         Display display = wm.getDefaultDisplay();
//         displayWidth = display.getWidth();
//         displayHeight = display.getHeight();
//         if (displayHeight > displayWidth) {
//             Log.d(TAG, "Swapping display width and height "+displayWidth+", "+displayHeight);
//             displayWidth = displayWidth + displayHeight;
//             displayHeight = displayWidth - displayHeight;
//             displayWidth = displayWidth - displayHeight;
//         }
//         initialized = true;
//     }
// 
//     public static void destroy() {
//         music.destroy();
//         initialized = false;
//     }
// }


import net.panuska.tlappy.awt.BufferedImage;
import static net.panuska.tlappy.Device.*;
package net.panuska.tlappy;

/**
 * Flappy:
 *   Original game created by dB-SOFT in 1984 for SHARP MZ-800 computer.
 *   Java version by Petr Slechta, 2014.
 */
class Moveable {

    protected int x, y;
    protected byte objType;
    protected byte number;
    protected byte sig;
    protected boolean finished = false;
    protected byte[][] model;
    protected Scene scene;

    protected Moveable(int x, int y, byte objType, int num, Scene scene) {
        this.x = x;
        this.y = y;
        this.objType = objType;
        this.number = (byte) num;
        this.sig = (byte) (objType | num);
        this.model = scene.getModel();
        this.scene = scene;
    }

    boolean isFinished() {
        return finished;
    }

// Path: core/src/main/java/net/panuska/tlappy/awt/BufferedImage.java
// public class BufferedImage {
//     private Bitmap b;
//     private Graphics g;
//     public static final int TYPE_INT_RGB = Bitmap.Config.ARGB_8888.ordinal();
// 
//     public BufferedImage(BitmapDrawable d) {
//         Bitmap immb = d.getBitmap();
//         b = immb.copy(Bitmap.Config.ARGB_8888, false);
//     }
// 
//     public BufferedImage(int width,
//                          int height,
//                          int imageType) {
//         b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
//         g = new Graphics(b);
//     }
// 
//     private BufferedImage(Bitmap b) {
//         this.b = b;
//     }
// 
//     public Graphics getGraphics() {
//         return g;
//     }
// 
//     public Bitmap getBitmap() {
//         return b;
//     }
// 
//     public BufferedImage getSubimage (int x, int y, int w, int h) {
//         Bitmap b = Bitmap.createBitmap(this.b, x, y, w, h);
//         return new BufferedImage(b);
//     }
// 
//     /**
//      * Returns a copy of this image rotated by 90 degrees.
//      * @return
//      */
//     public BufferedImage getRotatedImage() {
//         Matrix matrix = new Matrix();
//         matrix.postRotate(90);
//         Bitmap b = Bitmap.createBitmap(this.getBitmap(), 0, 0, this.getWidth(), this.getHeight(),  matrix, false);
//         return new BufferedImage(b);
//     }
// 
//     /**
//      * Returns a copy of this image mirrored by vertical axis
//      * @return
//      */
//     public BufferedImage getMirroredImage() {
//         Matrix matrix = new Matrix();
//         matrix.preScale(-1, 1);
//         Bitmap b = Bitmap.createBitmap(this.getBitmap(), 0, 0, this.getWidth(), this.getHeight(),  matrix, false);
//         return new BufferedImage(b);
//     }
// 
//     /**
//      * Returns 16x16 subimage starting at x, y
//      * @param x
//      * @param y
//      * @return
//      */
//     public BufferedImage getSubimage (int x, int y) {
//         return getSubimage(x, y, 16, 16);
//     }
// 
//     public int getWidth() {
//         return b.getWidth();
//     }
// 
//     public int getHeight() {
//         return b.getHeight();
//     }
// }
// 
// Path: core/src/main/java/net/panuska/tlappy/Device.java
// public class Device {
//     private static final String TAG = Device.class.getSimpleName();
//     public static Keyboard keyboard;
//     public static VRAM vram;
//     public static Music music;
// 
//     public static int displayWidth;
//     public static int displayHeight;
// 
//     public static boolean initialized = false;
//     public static void init (SurfaceView view) {
//         if (initialized) {
//             Log.d(TAG, "Device already initialized");
//             return;
//         }
//         Log.d(TAG, "Init");
//         Images.load(view.getResources());
//         keyboard = Keyboard.getInstance();
//         vram = VRAM.getInstance();
//         vram.createWindow(view);
//         music = Music.getInstance(view.getContext());
//         WindowManager wm = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE);
//         Display display = wm.getDefaultDisplay();
//         displayWidth = display.getWidth();
//         displayHeight = display.getHeight();
//         if (displayHeight > displayWidth) {
//             Log.d(TAG, "Swapping display width and height "+displayWidth+", "+displayHeight);
//             displayWidth = displayWidth + displayHeight;
//             displayHeight = displayWidth - displayHeight;
//             displayWidth = displayWidth - displayHeight;
//         }
//         initialized = true;
//     }
// 
//     public static void destroy() {
//         music.destroy();
//         initialized = false;
//     }
// }


// Path: core/src/main/java/net/panuska/tlappy/Moveable.java
import net.panuska.tlappy.awt.BufferedImage;
import static net.panuska.tlappy.Device.*;

package net.panuska.tlappy;

/**
 * Flappy:
 *   Original game created by dB-SOFT in 1984 for SHARP MZ-800 computer.
 *   Java version by Petr Slechta, 2014.
 */
class Moveable {

    protected int x, y;
    protected byte objType;
    protected byte number;
    protected byte sig;
    protected boolean finished = false;
    protected byte[][] model;
    protected Scene scene;

    protected Moveable(int x, int y, byte objType, int num, Scene scene) {
        this.x = x;
        this.y = y;
        this.objType = objType;
        this.number = (byte) num;
        this.sig = (byte) (objType | num);
        this.model = scene.getModel();
        this.scene = scene;
    }

    boolean isFinished() {
        return finished;
    }

    protected void drawMe(BufferedImage img) {