Index: AndroidManifest.xml
===================================================================
--- AndroidManifest.xml	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ AndroidManifest.xml	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.example.advancewars"
+      package="com.medievaltech.advancewars"
       android:versionCode="1"
       android:versionName="1.0">
Index: c/com/example/advancewars/AppState.java
===================================================================
--- src/com/example/advancewars/AppState.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,9 +1,0 @@
-package com.example.advancewars;
-
-public enum AppState {
-	LOSE,
-	PAUSE,
-	READY,
-	RUNNING,
-	WIN
-}
Index: c/com/example/advancewars/Game.java
===================================================================
--- src/com/example/advancewars/Game.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,131 +1,0 @@
-package com.example.advancewars;
-
-import com.example.advancewars.R;
-import com.example.advancewars.GameView;
-import com.example.advancewars.GameView.DrawingThread;
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.Window;
-import android.widget.TextView;
-import java.io.*;
-
-public class Game extends Activity {
-    private static final int MENU_EXIT = 1;
-    private static final int MENU_NEW = 2;
-    
-    public enum State{BUST, ACTIVE, DOUBLEDOWN};
-
-    /** A handle to the thread that's actually running the animation. */
-    public DrawingThread mThread;
-
-    /** A handle to the View in which the game is running. */
-    private GameView mGameView;
-    
-    /**
-     * Invoked during init to give the Activity a chance to set up its Menu.
-     * 
-     * @param menu the Menu to which entries may be added
-     * @return true
-     */
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        super.onCreateOptionsMenu(menu);
-
-        menu.add(0, MENU_EXIT, 0, R.string.menu_exit);
-        return true;
-    }
-
-    /**
-     * Invoked when the user selects an item from the Menu.
-     * 
-     * @param item the Menu entry which was selected
-     * @return true if the Menu item was legit (and we consumed it), false
-     *         otherwise
-     */
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case MENU_EXIT:
-            	this.finish();
-            	break;
-        }
-
-        return true;
-    }
-
-    /**
-     * Invoked when the Activity is created.
-     * 
-     * @param savedInstanceState a Bundle containing state saved from a previous
-     *        execution, or null if this is a new execution
-     */
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-    	Log.w("AdvanceWars", "We're inside onCreate");
-    	
-        super.onCreate(savedInstanceState);
-        
-        Log.w("AdvanceWars", "the super constructor was called successfully");
-
-        // turn off the window's title bar
-        requestWindowFeature(Window.FEATURE_NO_TITLE);
-
-        // tell system to use the layout defined in our XML file
-        setContentView(R.layout.main);
-
-        mGameView = (GameView) findViewById(R.id.lunar);
-        mThread = mGameView.getThread();
-        mGameView.mGame = this;
-
-        mGameView.setTextView((TextView) findViewById(R.id.text));
-
-        if (savedInstanceState == null) {	// we were just launched: set up a new game
-        	Log.w("AdvanceWars", "SIS is null");
-        	
-        	mThread.setState(AppState.RUNNING);
-        } else {
-            Log.w("AdvanceWars", "SIS is nonnull");
-            
-            mThread.setState(AppState.RUNNING);
-            
-            mGameView.getThread().mGameState = (GameState)savedInstanceState.getSerializable("gameState");
-            
-		    mGameView.getThread().mPlayerWins = savedInstanceState.getInt("playerWins");
-		    mGameView.getThread().mPlayerLosses = savedInstanceState.getInt("playerLosses");
-        }
-    }
-
-    /**
-     * Invoked when the Activity loses user focus.
-     */
-    @Override
-    protected void onPause() {
-        super.onPause();
-        mGameView.getThread().pause(); // pause game when Activity pauses
-    }
-
-    /**
-     * Notification that something is about to happen, to give the Activity a
-     * chance to save state.
-     * 
-     * @param outState a Bundle into which this Activity should save its state
-     */
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-    	outState.putSerializable("gameState", mGameView.getThread().mGameState);
-	    outState.putSerializable("playerWins", mGameView.getThread().mPlayerWins);
-	    outState.putSerializable("playerLosses", mGameView.getThread().mPlayerLosses);
-	    
-        super.onSaveInstanceState(outState);
-        Log.w("Blackjack", "onSaveInstanceState called");
-    }
-    
-    @Override
-    protected void onStop() {
-    	System.exit(1);
-    	super.onStop();
-    }
-}
Index: c/com/example/advancewars/GameState.java
===================================================================
--- src/com/example/advancewars/GameState.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,6 +1,0 @@
-package com.example.advancewars;
-
-public enum GameState {
-	MAIN_MENU,
-	BATTLE_MAP
-}
Index: c/com/example/advancewars/GameView.java
===================================================================
--- src/com/example/advancewars/GameView.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,503 +1,0 @@
-package com.example.advancewars;
-
-import java.util.*;
-
-import com.example.gui.*;
-
-import android.content.Context;
-import android.graphics.*;
-import android.os.*;
-import android.view.*;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.widget.TextView;
-
-/**
- * View that draws, takes keystrokes, etc. for a simple LunarLander game.
- * 
- * Has a mode which RUNNING, PAUSED, etc. Has a x, y, dx, dy, ... capturing the
- * current ship physics. All x/y etc. are measured with (0,0) at the lower left.
- * updatePhysics() advances the physics based on realtime. draw() renders the
- * ship, and does an invalidate() to prompt another draw() as soon as possible
- * by the system.
- */
-class GameView extends SurfaceView implements SurfaceHolder.Callback {
-	
-    class DrawingThread extends Thread {        
-        public AppState mAppState;
-        public GameState mGameState;
-
-        /*
-         * UI constants (i.e. the speed & fuel bars)
-         */
-        public static final int UI_BAR = 100; // width of the bar(s)
-        public static final int UI_BAR_HEIGHT = 10; // height of the bar(s)
-
-        /*
-         * Member (state) fields
-         */
-
-        private int mCanvasHeight = 1;
-        private int mCanvasWidth = 1;
-        public int mPlayerWins = 0, mPlayerLosses = 0;
-
-        /** Message handler used by thread to interact with TextView */
-        private Handler mHandler;
-
-        /** Used to figure out elapsed time between frames */
-        private long mLastTime;
-
-        /** Paint to draw the lines on screen. */
-        private Paint mLinePaint, mTextPaint, mButtonPaint, mTilePaint1, mTilePaint2;
-        
-        private Map mMap;
-
-        /** Indicate whether the surface has been created & is ready to draw */
-        private boolean mRun = false;
-
-        /** Handle to the surface manager object we interact with */
-        private SurfaceHolder mSurfaceHolder;
-        
-        private com.example.gui.Window wndMainMenu, wndBattleMap;
-        
-        public DrawingThread(SurfaceHolder surfaceHolder, Context context, Handler handler) {
-            // get handles to some important objects
-            mSurfaceHolder = surfaceHolder;
-            mHandler = handler;
-            mContext = context;
-            
-            mLinePaint = new Paint();
-            mLinePaint.setAntiAlias(true);
-            mLinePaint.setARGB(255, 0, 255, 0);
-
-            mTextPaint = new Paint();
-            mTextPaint.setAntiAlias(true);
-            mTextPaint.setARGB(255, 255, 255, 255);
-            mTextPaint.setTextSize(12);
-            mTextPaint.setTextAlign(Paint.Align.CENTER);
-            
-            mButtonPaint = new Paint();
-            mButtonPaint.setAntiAlias(true);
-            mButtonPaint.setARGB(255, 0, 0, 0);
-            mButtonPaint.setTextSize(20);
-            mButtonPaint.setTextAlign(Paint.Align.CENTER);
-            
-            mTilePaint1 = new Paint();
-            mTilePaint1.setAntiAlias(true);
-            mTilePaint1.setARGB(255, 0, 255, 0);
-            
-            mTilePaint2 = new Paint();
-            mTilePaint2.setAntiAlias(true);
-            mTilePaint2.setARGB(255, 0, 0, 255);
-            
-            wndMainMenu = new com.example.gui.Window(0, 0, 320, 450);;
-            wndMainMenu.addGUIObject("txtTitle", new Text("Main Menu", 100, 30, 120, 20, mTextPaint));
-            wndMainMenu.addGUIObject("btnNewGame", new Button("New Game", 100, 90, 120, 20, mLinePaint, mButtonPaint));
-            wndMainMenu.addGUIObject("btnLoadGame", new Button("Load Game", 100, 125, 120, 20, mLinePaint, mButtonPaint));
-            wndMainMenu.addGUIObject("btnMapEditor", new Button("Map Editor", 100, 160, 120, 20, mLinePaint, mButtonPaint));
-            wndMainMenu.addGUIObject("btnQuit", new Button("Quit", 100, 195, 120, 20, mLinePaint, mButtonPaint));
-            
-            Tile grassTile = new Tile(mTilePaint1);
-            Tile oceanTile = new Tile(mTilePaint2);
-            
-            mMap = new Map(grassTile, 6, 8);
-            
-            boolean land = true;
-            
-            for(int x=0; x<mMap.getWidth(); x++) {
-    			for(int y=0; y<mMap.getHeight(); y++) {
-    				if(land)
-    					mMap.setTile(x, y, grassTile);
-    				else
-    					mMap.setTile(x, y, oceanTile);
-    				land = !land;
-    			}
-    			land = !land;
-            }
-            
-            mGameState = GameState.MAIN_MENU;
-        }
-        
-        /**
-         * Starts the game, setting parameters for the current difficulty.
-         */
-        // I don't think this gets called now. maybe we should call it in the thread constructor
-        public void doStart() {
-            synchronized (mSurfaceHolder) {
-                mLastTime = System.currentTimeMillis() + 100;
-                setState(AppState.RUNNING);
-                Log.i("AdvanceWars", "Player's turn starting now");
-                mGameState = GameState.MAIN_MENU;
-            }
-        }
-
-        /**
-         * Pauses the physics update & animation.
-         */
-        public void pause() {
-            synchronized (mSurfaceHolder) {
-                if (mAppState == AppState.RUNNING) setState(AppState.PAUSE);
-            }
-        }
-
-        @Override
-        public void run() {
-            while (mRun) {
-                Canvas c = null;
-                try {
-                    c = mSurfaceHolder.lockCanvas(null);
-                    synchronized(mSurfaceHolder) {
-                        if(mAppState == AppState.RUNNING)
-                        	updatePhysics();
-                        doDraw(c);
-                    }
-                } finally {
-                    // do this in a finally so that if an exception is thrown
-                    // during the above, we don't leave the Surface in an
-                    // inconsistent state
-                    if (c != null) {
-                        mSurfaceHolder.unlockCanvasAndPost(c);
-                    }
-                }
-            }
-        }
-
-        /**
-         * Used to signal the thread whether it should be running or not.
-         * Passing true allows the thread to run; passing false will shut it
-         * down if it's already running. Calling start() after this was most
-         * recently called with false will result in an immediate shutdown.
-         * 
-         * @param b true to run, false to shut down
-         */
-        public void setRunning(boolean b) {
-            mRun = b;
-        }
-
-        /**
-         * Sets the game mode. That is, whether we are running, paused, in the
-         * failure state, in the victory state, etc.
-         * 
-         * @see #setState(int, CharSequence)
-         * @param mode one of the STATE_* constants
-         */
-        public void setState(AppState state) {
-            synchronized (mSurfaceHolder) {
-                setState(state, null);
-            }
-        }
-        
-        public void setGameState(GameState state) {
-            synchronized (mSurfaceHolder) {
-                mGameState = state;
-            }
-        }
-
-        /**
-         * Sets the game mode. That is, whether we are running, paused, in the
-         * failure state, in the victory state, etc.
-         * 
-         * @param mode one of the STATE_* constants
-         * @param message string to add to screen or null
-         */
-        public void setState(AppState mode, CharSequence message) {
-            /*
-             * This method optionally can cause a text message to be displayed
-             * to the user when the mode changes. Since the View that actually
-             * renders that text is part of the main View hierarchy and not
-             * owned by this thread, we can't touch the state of that View.
-             * Instead we use a Message + Handler to relay commands to the main
-             * thread, which updates the user-text View.
-             */
-            synchronized (mSurfaceHolder) {
-            	mAppState = mode;
-
-                if (mAppState == AppState.RUNNING) {
-                    Message msg = mHandler.obtainMessage();
-                    Bundle b = new Bundle();
-                    b.putString("text", "");
-                    b.putInt("viz", GameView.INVISIBLE);
-                    msg.setData(b);
-                    mHandler.sendMessage(msg);
-                } else {
-                    CharSequence str = "";
-                    str = "Mode probably changed";
-
-                    if (message != null) {
-                        str = message + "\n" + str;
-                    }
-
-                    Message msg = mHandler.obtainMessage();
-                    Bundle b = new Bundle();
-                    b.putString("text", str.toString());
-                    b.putInt("viz", GameView.VISIBLE);
-                    msg.setData(b);
-                    //mHandler.sendMessage(msg);
-                }
-            }
-        }
-        
-        /* Callback invoked when the surface dimensions change. */
-        public void setSurfaceSize(int width, int height) {
-            // synchronized to make sure these all change atomically
-            synchronized (mSurfaceHolder) {
-                mCanvasWidth = width;
-                mCanvasHeight = height;
-                
-                Log.i("AdvanceWars", "width: "+mCanvasWidth+", height: "+mCanvasHeight);
-            }
-        }
-
-        /**
-         * Resumes from a pause.
-         */
-        public void unpause() {
-            // Move the real time clock up to now
-            synchronized (mSurfaceHolder) {
-                mLastTime = System.currentTimeMillis() + 100;
-            }
-            setState(AppState.RUNNING);
-        }
-
-        /**
-         * Handles a key-down event.
-         * 
-         * @param keyCode the key that was pressed
-         * @param msg the original event object
-         * @return true
-         */
-        boolean doKeyDown(int keyCode, KeyEvent msg) {
-            synchronized (mSurfaceHolder) {
-                boolean okStart = false;
-                if (keyCode == KeyEvent.KEYCODE_DPAD_UP) okStart = true;
-                if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) okStart = true;
-                if (keyCode == KeyEvent.KEYCODE_S) okStart = true;
-
-                if (okStart
-                        && (mAppState == AppState.READY || mAppState == AppState.LOSE || mAppState == AppState.WIN)) {
-                    // ready-to-start -> start
-                    doStart();
-                    return true;
-                } else if (mAppState == AppState.PAUSE && okStart) {
-                    // paused -> running
-                    unpause();
-                    return true;
-                } else if (mAppState == AppState.RUNNING) {
-                    return true;
-                }
-
-                return false;
-            }
-        }
-
-        /**
-         * Handles a key-up event.
-         * 
-         * @param keyCode the key that was pressed
-         * @param msg the original event object
-         * @return true if the key was handled and consumed, or else false
-         */
-        boolean doKeyUp(int keyCode, KeyEvent msg) {
-            boolean handled = false;
-
-            synchronized (mSurfaceHolder) {
-                if (mAppState == AppState.RUNNING) {
-                    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER
-                            || keyCode == KeyEvent.KEYCODE_SPACE) {
-                        handled = true;
-                    } else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT
-                            || keyCode == KeyEvent.KEYCODE_Q
-                            || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT
-                            || keyCode == KeyEvent.KEYCODE_W) {
-                        handled = true;
-                    }
-                }
-            }
-
-            return handled;
-        }
-
-        /**
-         * Draws the ship, fuel/speed bars, and background to the provided
-         * Canvas.
-         */
-        private void doDraw(Canvas canvas) {
-        	canvas.drawColor(Color.BLACK);
-        	
-        	String text;
-        	Paint.FontMetrics metrics = mTextPaint.getFontMetrics();
-        	
-        	switch(mGameState) {
-        	case MAIN_MENU:
-            	wndMainMenu.draw(canvas);
-        		break;
-        	case BATTLE_MAP:
-        		mTextPaint.setTextSize(12);
-            	
-            	mMap.draw(canvas, 10, 25);
-            	
-            	text = "Advance Wars grid test";
-            	canvas.drawText(text, 0, 450-(metrics.ascent+metrics.descent)/2, mTextPaint);
-        		break;
-        	}
-        }
-
-        /**
-         * Figures the lander state (x, y, fuel, ...) based on the passage of
-         * realtime. Does not invalidate(). Called at the start of draw().
-         * Detects the end-of-game and sets the UI to the next state.
-         */
-        private void updatePhysics() {
-            long now = System.currentTimeMillis();
-
-            // Do nothing if mLastTime is in the future.
-            // This allows the game-start to delay the start of the physics
-            // by 100ms or whatever.
-            if (mLastTime > now) return;
-            
-            // DO SHIT HERE
-
-            mLastTime = now+50;
-        }
-    }
-
-    /** Handle to the application context, used to e.g. fetch Drawables. */
-    private Context mContext;
-
-    /** Pointer to the text view to display "Paused.." etc. */
-    private TextView mStatusText;
-
-    /** The thread that actually draws the animation */
-    private DrawingThread thread;
-    
-    public Game mGame;
-
-    public GameView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-
-        // register our interest in hearing about changes to our surface
-        SurfaceHolder holder = getHolder();
-        holder.addCallback(this);
-
-        // create thread only; it's started in surfaceCreated()
-        thread = new DrawingThread(holder, context, new Handler() {
-            @Override
-            public void handleMessage(Message m) {
-                mStatusText.setVisibility(m.getData().getInt("viz"));
-                mStatusText.setText(m.getData().getString("text"));
-            }
-        });
-
-        setFocusable(true); // make sure we get key events
-    }
-
-    @Override public boolean onTouchEvent(MotionEvent event) {
-    	Log.i("AdvanceWars", "Detected touch event");
-    	
-    	if(event.getAction() == MotionEvent.ACTION_UP) {
-    		Log.i("AdvanceWars", "Detected UP touch action");
-    		switch(thread.mGameState) {
-    		case MAIN_MENU:
-    			Log.i("AdvanceWars", "Switching to battle map");
-    			if(thread.wndMainMenu.getGUIObject("btnNewGame").isClicked(event.getX(), event.getY())) {
-    				thread.mGameState = GameState.BATTLE_MAP;
-    			}else if(thread.wndMainMenu.getGUIObject("btnLoadGame").isClicked(event.getX(), event.getY())) {
-    				thread.mGameState = GameState.BATTLE_MAP;
-    			}else if(thread.wndMainMenu.getGUIObject("btnQuit").isClicked(event.getX(), event.getY())) {
-    				mGame.finish();
-    			}
-    			break;
-    		case BATTLE_MAP:
-    			Log.i("AdvanceWars", "Touch event detected on battle map");
-    			thread.mGameState = GameState.MAIN_MENU;
-    			break;
-    		}
-    	}else if(event.getAction() == MotionEvent.ACTION_DOWN) {
-	    	
-    	}
-        
-        return true;
-    }
-    
-    /**
-     * Fetches the animation thread corresponding to this LunarView.
-     * 
-     * @return the animation thread
-     */
-    public DrawingThread getThread() {
-        return thread;
-    }
-
-    /**
-     * Standard override to get key-press events.
-     */
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent msg) {
-        return thread.doKeyDown(keyCode, msg);
-    }
-
-    /**
-     * Standard override for key-up. We actually care about these, so we can
-     * turn off the engine or stop rotating.
-     */
-    @Override
-    public boolean onKeyUp(int keyCode, KeyEvent msg) {
-        return thread.doKeyUp(keyCode, msg);
-    }
-
-    /**
-     * Standard window-focus override. Notice focus lost so we can pause on
-     * focus lost. e.g. user switches to take a call.
-     */
-    @Override
-    public void onWindowFocusChanged(boolean hasWindowFocus) {
-        if (!hasWindowFocus) thread.pause();
-    }
-
-    /**
-     * Installs a pointer to the text view used for messages.
-     */
-    public void setTextView(TextView textView) {
-        mStatusText = textView;
-    }
-
-    /* Callback invoked when the surface dimensions change. */
-    public void surfaceChanged(SurfaceHolder holder, int format, int width,
-            int height) {
-        thread.setSurfaceSize(width, height);
-    }
-
-    /*
-     * Callback invoked when the Surface has been created and is ready to be
-     * used.
-     */
-    public void surfaceCreated(SurfaceHolder holder) {
-        // start the thread here so that we don't busy-wait in run()
-        // waiting for the surface to be created
-        thread.setRunning(true);
-        
-        //if(thread.mAppState == AppState.PAUSE)
-        	//thread.unpause();
-        //else
-        	thread.start();
-    }
-
-    /*
-     * Callback invoked when the Surface has been destroyed and must no longer
-     * be touched. WARNING: after this method returns, the Surface/Canvas must
-     * never be touched again!
-     */
-    public void surfaceDestroyed(SurfaceHolder holder) {
-        // we have to tell thread to shut down & wait for it to finish, or else
-        // it might touch the Surface after we return and explode
-        boolean retry = true;
-        thread.setRunning(false);
-        while (retry) {
-            try {
-                thread.join();
-                retry = false;
-            } catch (InterruptedException e) {
-            }
-        }
-    }
-}
Index: c/com/example/advancewars/Map.java
===================================================================
--- src/com/example/advancewars/Map.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,43 +1,0 @@
-package com.example.advancewars;
-
-import android.graphics.Canvas;
-import android.graphics.Point;
-
-public class Map {
-	private Tile[][] grid;
-	
-	public Map(int width, int height) {
-		grid = new Tile[width][height];
-	}
-	
-	public Map(Tile t, int width, int height) {
-		grid = new Tile[width][height];
-		
-		for(int x=0; x<getWidth(); x++)
-			for(int y=0; y<getHeight(); y++)
-				grid[x][y] = t;
-	}
-	
-	public int getWidth() {
-		return grid.length;
-	}
-	
-	public int getHeight() {
-		return grid[0].length;
-	}
-	
-	public void setTile(int x, int y, Tile t) {
-		grid[x][y] = t;
-	}
-	
-	public void draw(Canvas c, int xStart, int yStart) {
-		for(int x=0; x<getWidth(); x++)
-			for(int y=0; y<getHeight(); y++)
-				grid[x][y].draw(c, xStart+50*x, yStart+50*y);
-	}
-	
-	public Tile getTile(Point point)
-	{
-		return grid[point.x][point.y];
-	}
-}
Index: c/com/example/advancewars/Tile.java
===================================================================
--- src/com/example/advancewars/Tile.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,43 +1,0 @@
-package com.example.advancewars;
-
-import com.example.game.Unit;
-
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Point;
-
-public class Tile {
-	public enum TerrainType
-	{
-		LAND, SEA
-	}
-	
-	TerrainType type;
-	public double moveCoefficent;
-	public Unit currentUnit;
-	public Point point;
-	
-	public void addUnit(Unit unit)
-	{
-		currentUnit = unit;	
-	}
-	
-	public void removeUnit(Unit unit)
-	{
-		if(currentUnit != null)
-		{
-			currentUnit = null;
-		}
-	
-	}
-	private Paint p;
-	
-	public Tile(Paint p) {
-		this.p = p;
-	}
-	
-	public void draw(Canvas c, int x, int y) {
-		c.drawRect(x, y, x+50, y+50, p);
-	}
-}
Index: c/com/example/game/Player.java
===================================================================
--- src/com/example/game/Player.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,11 +1,0 @@
-package com.example.game;
-
-public class Player {
-	public Player()
-	{
-		
-	}
-	
-	public String Name;
-	
-}
Index: c/com/example/game/Soldier.java
===================================================================
--- src/com/example/game/Soldier.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,42 +1,0 @@
-package com.example.game;
-
-import java.util.List;
-
-import android.graphics.Point;
-
-public class Soldier extends Unit{
-
-	@Override
-	public boolean move(Point point) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean attack(Point point) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public List<Point> getRange() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void die() 
-	{
-		
-	}
-
-	@Override
-	public List<Point> getAttackRange() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-		
-	
-
-}
Index: c/com/example/game/Transport.java
===================================================================
--- src/com/example/game/Transport.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,12 +1,0 @@
-package com.example.game;
-
-import java.util.List;
-
-import android.graphics.Point;
-
-public abstract class Transport extends Unit
-{
-	public Unit storedUnit;
-	
-
-}
Index: c/com/example/game/Unit.java
===================================================================
--- src/com/example/game/Unit.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.example.game;
-
-import java.util.List;
-
-import android.graphics.Point;
-
-public abstract class Unit 
-{
-	public Unit()
-	{
-		
-	}
-	public enum Type
-	{
-		LAND,SEA
-	}
-
-	public Type type;
-	public Player owner;
-	
-	public int maxHealth;
-	public int currentHealth;
-	
-	public int maxFuel;
-	public int currentFuel;
-	
-	public int sightRange;
-	public int move;
-	
-	public int minAttackRange;
-	public int maxAttackRange;
-	public Point location;
-	
-	public abstract boolean move(Point point);
-	public abstract boolean attack(Point point);
-	
-	public abstract List<Point> getRange();
-	public abstract List<Point> getAttackRange();
-	
-	public  void die()
-	{
-		
-	}
-	
-	
-	
-	
-	
-	
-	
-	
-}
Index: c/com/example/gui/Button.java
===================================================================
--- src/com/example/gui/Button.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,23 +1,0 @@
-package com.example.gui;
-
-import android.graphics.Canvas;
-import android.graphics.Paint;
-
-public class Button extends GUIObject {
-	private String text;
-	private Paint textPaint;
-	private float vOffset;
-	
-	public Button(String newText, int newX, int newY, int newWidth, int newHeight, Paint linePaint, Paint textPaint) {
-		super(newX, newY, newWidth, newHeight, linePaint);
-		
-		this.textPaint = textPaint;
-		text = newText;	
-		vOffset = -(textPaint.getFontMetrics().ascent+textPaint.getFontMetrics().descent)/2;
-	}
-	
-	public void draw(Canvas c) {
-		c.drawRect(x, y, x+width, y+height, p);
-		c.drawText(text, x+width/2, y+height/2+vOffset, textPaint);
-	} 
-}
Index: c/com/example/gui/GUIObject.java
===================================================================
--- src/com/example/gui/GUIObject.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,40 +1,0 @@
-package com.example.gui;
-
-import android.graphics.*;
-
-public class GUIObject {
-	protected int x, y, width, height;
-	protected Paint p;	//all properties of the object are determined through the paint object
-	
-	public GUIObject(int newX, int newY, int newWidth, int newHeight, Paint p) {
-		x = newX;
-		y = newY;
-		width = newWidth;
-		height = newHeight;
-		this.p = p;
-	}
-	
-	public void draw(Canvas c) {
-
-	}
-	
-	public boolean isClicked(float xCoord, float yCoord) {
-		return x <= xCoord && xCoord <= x+width && y <= yCoord && yCoord <= y+height;
-	}
-	
-	public int getX() {
-		return x;
-	}
-	
-	public int getY() {
-		return y;
-	}
-	
-	public int getWidth() {
-		return width;
-	}
-	
-	public int getHeight() {
-		return height;
-	}
-}
Index: c/com/example/gui/Text.java
===================================================================
--- src/com/example/gui/Text.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,22 +1,0 @@
-package com.example.gui;
-
-import android.graphics.Canvas;
-import android.graphics.Paint;
-
-public class Text extends GUIObject {
-	private String text;
-	private Paint textPaint;
-	private float vOffset;
-	
-	public Text(String newText, int newX, int newY, int newWidth, int newHeight, Paint textPaint) {
-		super(newX, newY, newWidth, newHeight, null);
-		
-		this.textPaint = textPaint;
-		text = newText;	
-		vOffset = -(textPaint.getFontMetrics().ascent+textPaint.getFontMetrics().descent)/2;
-	}
-	
-	public void draw(Canvas c) {
-		c.drawText(text, x+width/2, y+height/2+vOffset, textPaint);
-	} 
-}
Index: c/com/example/gui/Window.java
===================================================================
--- src/com/example/gui/Window.java	(revision 54e09651828fc0e8bd7dbb5b05bbbf8e0b2b5202)
+++ 	(revision )
@@ -1,29 +1,0 @@
-package com.example.gui;
-
-import java.util.Hashtable;
-
-import android.graphics.Canvas;
-
-public class Window extends GUIObject {
-	private Hashtable<String, GUIObject> drawableObjects;
-	
-	public Window(int newX, int newY, int newWidth, int newHeight) {
-		super(newX, newY, newWidth, newHeight, null);
-		
-		drawableObjects = new Hashtable<String, GUIObject>();
-	}
-	
-	public void addGUIObject(String name, GUIObject o) {
-		drawableObjects.put(name, o);
-	}
-	
-	public GUIObject getGUIObject(String name) {
-		return drawableObjects.get(name);
-	}
-	
-	public void draw(Canvas c) {
-		for (GUIObject o : drawableObjects.values()) {
-    		o.draw(c);
-    	}
-	}
-}
Index: src/com/medievaltech/advancewars/AppState.java
===================================================================
--- src/com/medievaltech/advancewars/AppState.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/advancewars/AppState.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,9 @@
+package com.medievaltech.advancewars;
+
+public enum AppState {
+	LOSE,
+	PAUSE,
+	READY,
+	RUNNING,
+	WIN
+}
Index: src/com/medievaltech/advancewars/Game.java
===================================================================
--- src/com/medievaltech/advancewars/Game.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/advancewars/Game.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,131 @@
+package com.medievaltech.advancewars;
+
+import com.medievaltech.advancewars.R;
+import com.medievaltech.advancewars.GameView;
+import com.medievaltech.advancewars.GameView.DrawingThread;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.Window;
+import android.widget.TextView;
+
+public class Game extends Activity {
+    private static final int MENU_EXIT = 1;
+    private static final int MENU_NEW = 2;
+    
+    public enum State{BUST, ACTIVE, DOUBLEDOWN};
+
+    /** A handle to the thread that's actually running the animation. */
+    public DrawingThread mThread;
+
+    /** A handle to the View in which the game is running. */
+    private GameView mGameView;
+    
+    /**
+     * Invoked during init to give the Activity a chance to set up its Menu.
+     * 
+     * @param menu the Menu to which entries may be added
+     * @return true
+     */
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+
+        menu.add(0, MENU_EXIT, 0, R.string.menu_exit);
+        return true;
+    }
+
+    /**
+     * Invoked when the user selects an item from the Menu.
+     * 
+     * @param item the Menu entry which was selected
+     * @return true if the Menu item was legit (and we consumed it), false
+     *         otherwise
+     */
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case MENU_EXIT:
+            	this.finish();
+            	break;
+        }
+
+        return true;
+    }
+
+    /**
+     * Invoked when the Activity is created.
+     * 
+     * @param savedInstanceState a Bundle containing state saved from a previous
+     *        execution, or null if this is a new execution
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+    	Log.w("AdvanceWars", "We're inside onCreate");
+    	
+        super.onCreate(savedInstanceState);
+        
+        Log.w("AdvanceWars", "the super constructor was called successfully");
+
+        // turn off the window's title bar
+        requestWindowFeature(Window.FEATURE_NO_TITLE);
+
+        // tell system to use the layout defined in our XML file
+        setContentView(R.layout.main);
+
+        mGameView = (GameView) findViewById(R.id.lunar);
+        mThread = mGameView.getThread();
+        mGameView.mGame = this;
+
+        mGameView.setTextView((TextView) findViewById(R.id.text));
+
+        if (savedInstanceState == null) {	// we were just launched: set up a new game
+        	Log.w("AdvanceWars", "SIS is null");
+        	
+        	mThread.setState(AppState.RUNNING);
+        } else {
+            Log.w("AdvanceWars", "SIS is nonnull");
+            
+            mThread.setState(AppState.RUNNING);
+            
+            mGameView.getThread().mGameState = (GameState)savedInstanceState.getSerializable("gameState");
+            
+		    mGameView.getThread().mPlayerWins = savedInstanceState.getInt("playerWins");
+		    mGameView.getThread().mPlayerLosses = savedInstanceState.getInt("playerLosses");
+        }
+    }
+
+    /**
+     * Invoked when the Activity loses user focus.
+     */
+    @Override
+    protected void onPause() {
+        super.onPause();
+        mGameView.getThread().pause(); // pause game when Activity pauses
+    }
+
+    /**
+     * Notification that something is about to happen, to give the Activity a
+     * chance to save state.
+     * 
+     * @param outState a Bundle into which this Activity should save its state
+     */
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+    	outState.putSerializable("gameState", mGameView.getThread().mGameState);
+	    outState.putSerializable("playerWins", mGameView.getThread().mPlayerWins);
+	    outState.putSerializable("playerLosses", mGameView.getThread().mPlayerLosses);
+	    
+        super.onSaveInstanceState(outState);
+        Log.w("Blackjack", "onSaveInstanceState called");
+    }
+    
+    @Override
+    protected void onStop() {
+    	System.exit(1);
+    	super.onStop();
+    }
+}
Index: src/com/medievaltech/advancewars/GameState.java
===================================================================
--- src/com/medievaltech/advancewars/GameState.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/advancewars/GameState.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,6 @@
+package com.medievaltech.advancewars;
+
+public enum GameState {
+	MAIN_MENU,
+	BATTLE_MAP
+}
Index: src/com/medievaltech/advancewars/GameView.java
===================================================================
--- src/com/medievaltech/advancewars/GameView.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/advancewars/GameView.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,501 @@
+package com.medievaltech.advancewars;
+
+import com.medievaltech.gui.*;
+
+import android.content.Context;
+import android.graphics.*;
+import android.os.*;
+import android.view.*;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.TextView;
+
+/**
+ * View that draws, takes keystrokes, etc. for a simple LunarLander game.
+ * 
+ * Has a mode which RUNNING, PAUSED, etc. Has a x, y, dx, dy, ... capturing the
+ * current ship physics. All x/y etc. are measured with (0,0) at the lower left.
+ * updatePhysics() advances the physics based on realtime. draw() renders the
+ * ship, and does an invalidate() to prompt another draw() as soon as possible
+ * by the system.
+ */
+class GameView extends SurfaceView implements SurfaceHolder.Callback {
+	
+    class DrawingThread extends Thread {        
+        public AppState mAppState;
+        public GameState mGameState;
+
+        /*
+         * UI constants (i.e. the speed & fuel bars)
+         */
+        public static final int UI_BAR = 100; // width of the bar(s)
+        public static final int UI_BAR_HEIGHT = 10; // height of the bar(s)
+
+        /*
+         * Member (state) fields
+         */
+
+        private int mCanvasHeight = 1;
+        private int mCanvasWidth = 1;
+        public int mPlayerWins = 0, mPlayerLosses = 0;
+
+        /** Message handler used by thread to interact with TextView */
+        private Handler mHandler;
+
+        /** Used to figure out elapsed time between frames */
+        private long mLastTime;
+
+        /** Paint to draw the lines on screen. */
+        private Paint mLinePaint, mTextPaint, mButtonPaint, mTilePaint1, mTilePaint2;
+        
+        private Map mMap;
+
+        /** Indicate whether the surface has been created & is ready to draw */
+        private boolean mRun = false;
+
+        /** Handle to the surface manager object we interact with */
+        private SurfaceHolder mSurfaceHolder;
+        
+        private com.medievaltech.gui.Window wndMainMenu, wndBattleMap;
+        
+        public DrawingThread(SurfaceHolder surfaceHolder, Context context, Handler handler) {
+            // get handles to some important objects
+            mSurfaceHolder = surfaceHolder;
+            mHandler = handler;
+            mContext = context;
+            
+            mLinePaint = new Paint();
+            mLinePaint.setAntiAlias(true);
+            mLinePaint.setARGB(255, 0, 255, 0);
+
+            mTextPaint = new Paint();
+            mTextPaint.setAntiAlias(true);
+            mTextPaint.setARGB(255, 255, 255, 255);
+            mTextPaint.setTextSize(12);
+            mTextPaint.setTextAlign(Paint.Align.CENTER);
+            
+            mButtonPaint = new Paint();
+            mButtonPaint.setAntiAlias(true);
+            mButtonPaint.setARGB(255, 0, 0, 0);
+            mButtonPaint.setTextSize(20);
+            mButtonPaint.setTextAlign(Paint.Align.CENTER);
+            
+            mTilePaint1 = new Paint();
+            mTilePaint1.setAntiAlias(true);
+            mTilePaint1.setARGB(255, 0, 255, 0);
+            
+            mTilePaint2 = new Paint();
+            mTilePaint2.setAntiAlias(true);
+            mTilePaint2.setARGB(255, 0, 0, 255);
+            
+            wndMainMenu = new com.medievaltech.gui.Window(0, 0, 320, 450);;
+            wndMainMenu.addGUIObject("txtTitle", new Text("Main Menu", 100, 30, 120, 20, mTextPaint));
+            wndMainMenu.addGUIObject("btnNewGame", new Button("New Game", 100, 90, 120, 20, mLinePaint, mButtonPaint));
+            wndMainMenu.addGUIObject("btnLoadGame", new Button("Load Game", 100, 125, 120, 20, mLinePaint, mButtonPaint));
+            wndMainMenu.addGUIObject("btnMapEditor", new Button("Map Editor", 100, 160, 120, 20, mLinePaint, mButtonPaint));
+            wndMainMenu.addGUIObject("btnQuit", new Button("Quit", 100, 195, 120, 20, mLinePaint, mButtonPaint));
+            
+            Tile grassTile = new Tile(mTilePaint1);
+            Tile oceanTile = new Tile(mTilePaint2);
+            
+            mMap = new Map(grassTile, 6, 8);
+            
+            boolean land = true;
+            
+            for(int x=0; x<mMap.getWidth(); x++) {
+    			for(int y=0; y<mMap.getHeight(); y++) {
+    				if(land)
+    					mMap.setTile(x, y, grassTile);
+    				else
+    					mMap.setTile(x, y, oceanTile);
+    				land = !land;
+    			}
+    			land = !land;
+            }
+            
+            mGameState = GameState.MAIN_MENU;
+        }
+        
+        /**
+         * Starts the game, setting parameters for the current difficulty.
+         */
+        // I don't think this gets called now. maybe we should call it in the thread constructor
+        public void doStart() {
+            synchronized (mSurfaceHolder) {
+                mLastTime = System.currentTimeMillis() + 100;
+                setState(AppState.RUNNING);
+                Log.i("AdvanceWars", "Player's turn starting now");
+                mGameState = GameState.MAIN_MENU;
+            }
+        }
+
+        /**
+         * Pauses the physics update & animation.
+         */
+        public void pause() {
+            synchronized (mSurfaceHolder) {
+                if (mAppState == AppState.RUNNING) setState(AppState.PAUSE);
+            }
+        }
+
+        @Override
+        public void run() {
+            while (mRun) {
+                Canvas c = null;
+                try {
+                    c = mSurfaceHolder.lockCanvas(null);
+                    synchronized(mSurfaceHolder) {
+                        if(mAppState == AppState.RUNNING)
+                        	updatePhysics();
+                        doDraw(c);
+                    }
+                } finally {
+                    // do this in a finally so that if an exception is thrown
+                    // during the above, we don't leave the Surface in an
+                    // inconsistent state
+                    if (c != null) {
+                        mSurfaceHolder.unlockCanvasAndPost(c);
+                    }
+                }
+            }
+        }
+
+        /**
+         * Used to signal the thread whether it should be running or not.
+         * Passing true allows the thread to run; passing false will shut it
+         * down if it's already running. Calling start() after this was most
+         * recently called with false will result in an immediate shutdown.
+         * 
+         * @param b true to run, false to shut down
+         */
+        public void setRunning(boolean b) {
+            mRun = b;
+        }
+
+        /**
+         * Sets the game mode. That is, whether we are running, paused, in the
+         * failure state, in the victory state, etc.
+         * 
+         * @see #setState(int, CharSequence)
+         * @param mode one of the STATE_* constants
+         */
+        public void setState(AppState state) {
+            synchronized (mSurfaceHolder) {
+                setState(state, null);
+            }
+        }
+        
+        public void setGameState(GameState state) {
+            synchronized (mSurfaceHolder) {
+                mGameState = state;
+            }
+        }
+
+        /**
+         * Sets the game mode. That is, whether we are running, paused, in the
+         * failure state, in the victory state, etc.
+         * 
+         * @param mode one of the STATE_* constants
+         * @param message string to add to screen or null
+         */
+        public void setState(AppState mode, CharSequence message) {
+            /*
+             * This method optionally can cause a text message to be displayed
+             * to the user when the mode changes. Since the View that actually
+             * renders that text is part of the main View hierarchy and not
+             * owned by this thread, we can't touch the state of that View.
+             * Instead we use a Message + Handler to relay commands to the main
+             * thread, which updates the user-text View.
+             */
+            synchronized (mSurfaceHolder) {
+            	mAppState = mode;
+
+                if (mAppState == AppState.RUNNING) {
+                    Message msg = mHandler.obtainMessage();
+                    Bundle b = new Bundle();
+                    b.putString("text", "");
+                    b.putInt("viz", GameView.INVISIBLE);
+                    msg.setData(b);
+                    mHandler.sendMessage(msg);
+                } else {
+                    CharSequence str = "";
+                    str = "Mode probably changed";
+
+                    if (message != null) {
+                        str = message + "\n" + str;
+                    }
+
+                    Message msg = mHandler.obtainMessage();
+                    Bundle b = new Bundle();
+                    b.putString("text", str.toString());
+                    b.putInt("viz", GameView.VISIBLE);
+                    msg.setData(b);
+                    //mHandler.sendMessage(msg);
+                }
+            }
+        }
+        
+        /* Callback invoked when the surface dimensions change. */
+        public void setSurfaceSize(int width, int height) {
+            // synchronized to make sure these all change atomically
+            synchronized (mSurfaceHolder) {
+                mCanvasWidth = width;
+                mCanvasHeight = height;
+                
+                Log.i("AdvanceWars", "width: "+mCanvasWidth+", height: "+mCanvasHeight);
+            }
+        }
+
+        /**
+         * Resumes from a pause.
+         */
+        public void unpause() {
+            // Move the real time clock up to now
+            synchronized (mSurfaceHolder) {
+                mLastTime = System.currentTimeMillis() + 100;
+            }
+            setState(AppState.RUNNING);
+        }
+
+        /**
+         * Handles a key-down event.
+         * 
+         * @param keyCode the key that was pressed
+         * @param msg the original event object
+         * @return true
+         */
+        boolean doKeyDown(int keyCode, KeyEvent msg) {
+            synchronized (mSurfaceHolder) {
+                boolean okStart = false;
+                if (keyCode == KeyEvent.KEYCODE_DPAD_UP) okStart = true;
+                if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) okStart = true;
+                if (keyCode == KeyEvent.KEYCODE_S) okStart = true;
+
+                if (okStart
+                        && (mAppState == AppState.READY || mAppState == AppState.LOSE || mAppState == AppState.WIN)) {
+                    // ready-to-start -> start
+                    doStart();
+                    return true;
+                } else if (mAppState == AppState.PAUSE && okStart) {
+                    // paused -> running
+                    unpause();
+                    return true;
+                } else if (mAppState == AppState.RUNNING) {
+                    return true;
+                }
+
+                return false;
+            }
+        }
+
+        /**
+         * Handles a key-up event.
+         * 
+         * @param keyCode the key that was pressed
+         * @param msg the original event object
+         * @return true if the key was handled and consumed, or else false
+         */
+        boolean doKeyUp(int keyCode, KeyEvent msg) {
+            boolean handled = false;
+
+            synchronized (mSurfaceHolder) {
+                if (mAppState == AppState.RUNNING) {
+                    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER
+                            || keyCode == KeyEvent.KEYCODE_SPACE) {
+                        handled = true;
+                    } else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT
+                            || keyCode == KeyEvent.KEYCODE_Q
+                            || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT
+                            || keyCode == KeyEvent.KEYCODE_W) {
+                        handled = true;
+                    }
+                }
+            }
+
+            return handled;
+        }
+
+        /**
+         * Draws the ship, fuel/speed bars, and background to the provided
+         * Canvas.
+         */
+        private void doDraw(Canvas canvas) {
+        	canvas.drawColor(Color.BLACK);
+        	
+        	String text;
+        	Paint.FontMetrics metrics = mTextPaint.getFontMetrics();
+        	
+        	switch(mGameState) {
+        	case MAIN_MENU:
+            	wndMainMenu.draw(canvas);
+        		break;
+        	case BATTLE_MAP:
+        		mTextPaint.setTextSize(12);
+            	
+            	mMap.draw(canvas, 10, 25);
+            	
+            	text = "Advance Wars grid test";
+            	canvas.drawText(text, 0, 450-(metrics.ascent+metrics.descent)/2, mTextPaint);
+        		break;
+        	}
+        }
+
+        /**
+         * Figures the lander state (x, y, fuel, ...) based on the passage of
+         * realtime. Does not invalidate(). Called at the start of draw().
+         * Detects the end-of-game and sets the UI to the next state.
+         */
+        private void updatePhysics() {
+            long now = System.currentTimeMillis();
+
+            // Do nothing if mLastTime is in the future.
+            // This allows the game-start to delay the start of the physics
+            // by 100ms or whatever.
+            if (mLastTime > now) return;
+            
+            // DO SHIT HERE
+
+            mLastTime = now+50;
+        }
+    }
+
+    /** Handle to the application context, used to e.g. fetch Drawables. */
+    private Context mContext;
+
+    /** Pointer to the text view to display "Paused.." etc. */
+    private TextView mStatusText;
+
+    /** The thread that actually draws the animation */
+    private DrawingThread thread;
+    
+    public Game mGame;
+
+    public GameView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        // register our interest in hearing about changes to our surface
+        SurfaceHolder holder = getHolder();
+        holder.addCallback(this);
+
+        // create thread only; it's started in surfaceCreated()
+        thread = new DrawingThread(holder, context, new Handler() {
+            @Override
+            public void handleMessage(Message m) {
+                mStatusText.setVisibility(m.getData().getInt("viz"));
+                mStatusText.setText(m.getData().getString("text"));
+            }
+        });
+
+        setFocusable(true); // make sure we get key events
+    }
+
+    @Override public boolean onTouchEvent(MotionEvent event) {
+    	Log.i("AdvanceWars", "Detected touch event");
+    	
+    	if(event.getAction() == MotionEvent.ACTION_UP) {
+    		Log.i("AdvanceWars", "Detected UP touch action");
+    		switch(thread.mGameState) {
+    		case MAIN_MENU:
+    			Log.i("AdvanceWars", "Switching to battle map");
+    			if(thread.wndMainMenu.getGUIObject("btnNewGame").isClicked(event.getX(), event.getY())) {
+    				thread.mGameState = GameState.BATTLE_MAP;
+    			}else if(thread.wndMainMenu.getGUIObject("btnLoadGame").isClicked(event.getX(), event.getY())) {
+    				thread.mGameState = GameState.BATTLE_MAP;
+    			}else if(thread.wndMainMenu.getGUIObject("btnQuit").isClicked(event.getX(), event.getY())) {
+    				mGame.finish();
+    			}
+    			break;
+    		case BATTLE_MAP:
+    			Log.i("AdvanceWars", "Touch event detected on battle map");
+    			thread.mGameState = GameState.MAIN_MENU;
+    			break;
+    		}
+    	}else if(event.getAction() == MotionEvent.ACTION_DOWN) {
+	    	
+    	}
+        
+        return true;
+    }
+    
+    /**
+     * Fetches the animation thread corresponding to this LunarView.
+     * 
+     * @return the animation thread
+     */
+    public DrawingThread getThread() {
+        return thread;
+    }
+
+    /**
+     * Standard override to get key-press events.
+     */
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent msg) {
+        return thread.doKeyDown(keyCode, msg);
+    }
+
+    /**
+     * Standard override for key-up. We actually care about these, so we can
+     * turn off the engine or stop rotating.
+     */
+    @Override
+    public boolean onKeyUp(int keyCode, KeyEvent msg) {
+        return thread.doKeyUp(keyCode, msg);
+    }
+
+    /**
+     * Standard window-focus override. Notice focus lost so we can pause on
+     * focus lost. e.g. user switches to take a call.
+     */
+    @Override
+    public void onWindowFocusChanged(boolean hasWindowFocus) {
+        if (!hasWindowFocus) thread.pause();
+    }
+
+    /**
+     * Installs a pointer to the text view used for messages.
+     */
+    public void setTextView(TextView textView) {
+        mStatusText = textView;
+    }
+
+    /* Callback invoked when the surface dimensions change. */
+    public void surfaceChanged(SurfaceHolder holder, int format, int width,
+            int height) {
+        thread.setSurfaceSize(width, height);
+    }
+
+    /*
+     * Callback invoked when the Surface has been created and is ready to be
+     * used.
+     */
+    public void surfaceCreated(SurfaceHolder holder) {
+        // start the thread here so that we don't busy-wait in run()
+        // waiting for the surface to be created
+        thread.setRunning(true);
+        
+        //if(thread.mAppState == AppState.PAUSE)
+        	//thread.unpause();
+        //else
+        	thread.start();
+    }
+
+    /*
+     * Callback invoked when the Surface has been destroyed and must no longer
+     * be touched. WARNING: after this method returns, the Surface/Canvas must
+     * never be touched again!
+     */
+    public void surfaceDestroyed(SurfaceHolder holder) {
+        // we have to tell thread to shut down & wait for it to finish, or else
+        // it might touch the Surface after we return and explode
+        boolean retry = true;
+        thread.setRunning(false);
+        while (retry) {
+            try {
+                thread.join();
+                retry = false;
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+}
Index: src/com/medievaltech/advancewars/Map.java
===================================================================
--- src/com/medievaltech/advancewars/Map.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/advancewars/Map.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,43 @@
+package com.medievaltech.advancewars;
+
+import android.graphics.Canvas;
+import android.graphics.Point;
+
+public class Map {
+	private Tile[][] grid;
+	
+	public Map(int width, int height) {
+		grid = new Tile[width][height];
+	}
+	
+	public Map(Tile t, int width, int height) {
+		grid = new Tile[width][height];
+		
+		for(int x=0; x<getWidth(); x++)
+			for(int y=0; y<getHeight(); y++)
+				grid[x][y] = t;
+	}
+	
+	public int getWidth() {
+		return grid.length;
+	}
+	
+	public int getHeight() {
+		return grid[0].length;
+	}
+	
+	public void setTile(int x, int y, Tile t) {
+		grid[x][y] = t;
+	}
+	
+	public void draw(Canvas c, int xStart, int yStart) {
+		for(int x=0; x<getWidth(); x++)
+			for(int y=0; y<getHeight(); y++)
+				grid[x][y].draw(c, xStart+50*x, yStart+50*y);
+	}
+	
+	public Tile getTile(Point point)
+	{
+		return grid[point.x][point.y];
+	}
+}
Index: src/com/medievaltech/advancewars/Tile.java
===================================================================
--- src/com/medievaltech/advancewars/Tile.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/advancewars/Tile.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,42 @@
+package com.medievaltech.advancewars;
+
+import com.medievaltech.game.Unit;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Point;
+
+public class Tile {
+	public enum TerrainType
+	{
+		LAND, SEA
+	}
+	
+	TerrainType type;
+	public double moveCoefficent;
+	public Unit currentUnit;
+	public Point point;
+	
+	public void addUnit(Unit unit)
+	{
+		currentUnit = unit;	
+	}
+	
+	public void removeUnit(Unit unit)
+	{
+		if(currentUnit != null)
+		{
+			currentUnit = null;
+		}
+	
+	}
+	private Paint p;
+	
+	public Tile(Paint p) {
+		this.p = p;
+	}
+	
+	public void draw(Canvas c, int x, int y) {
+		c.drawRect(x, y, x+50, y+50, p);
+	}
+}
Index: src/com/medievaltech/game/Player.java
===================================================================
--- src/com/medievaltech/game/Player.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/game/Player.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,11 @@
+package com.medievaltech.game;
+
+public class Player {
+	public Player()
+	{
+		
+	}
+	
+	public String Name;
+	
+}
Index: src/com/medievaltech/game/Soldier.java
===================================================================
--- src/com/medievaltech/game/Soldier.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/game/Soldier.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,42 @@
+package com.medievaltech.game;
+
+import java.util.List;
+
+import android.graphics.Point;
+
+public class Soldier extends Unit{
+
+	@Override
+	public boolean move(Point point) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean attack(Point point) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public List<Point> getRange() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void die() 
+	{
+		
+	}
+
+	@Override
+	public List<Point> getAttackRange() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+		
+	
+
+}
Index: src/com/medievaltech/game/Transport.java
===================================================================
--- src/com/medievaltech/game/Transport.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/game/Transport.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,8 @@
+package com.medievaltech.game;
+
+public abstract class Transport extends Unit
+{
+	public Unit storedUnit;
+	
+
+}
Index: src/com/medievaltech/game/Unit.java
===================================================================
--- src/com/medievaltech/game/Unit.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/game/Unit.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,52 @@
+package com.medievaltech.game;
+
+import java.util.List;
+
+import android.graphics.Point;
+
+public abstract class Unit 
+{
+	public Unit()
+	{
+		
+	}
+	public enum Type
+	{
+		LAND,SEA
+	}
+
+	public Type type;
+	public Player owner;
+	
+	public int maxHealth;
+	public int currentHealth;
+	
+	public int maxFuel;
+	public int currentFuel;
+	
+	public int sightRange;
+	public int move;
+	
+	public int minAttackRange;
+	public int maxAttackRange;
+	public Point location;
+	
+	public abstract boolean move(Point point);
+	public abstract boolean attack(Point point);
+	
+	public abstract List<Point> getRange();
+	public abstract List<Point> getAttackRange();
+	
+	public  void die()
+	{
+		
+	}
+	
+	
+	
+	
+	
+	
+	
+	
+}
Index: src/com/medievaltech/gui/Button.java
===================================================================
--- src/com/medievaltech/gui/Button.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/gui/Button.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,23 @@
+package com.medievaltech.gui;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+
+public class Button extends GUIObject {
+	private String text;
+	private Paint textPaint;
+	private float vOffset;
+	
+	public Button(String newText, int newX, int newY, int newWidth, int newHeight, Paint linePaint, Paint textPaint) {
+		super(newX, newY, newWidth, newHeight, linePaint);
+		
+		this.textPaint = textPaint;
+		text = newText;	
+		vOffset = -(textPaint.getFontMetrics().ascent+textPaint.getFontMetrics().descent)/2;
+	}
+	
+	public void draw(Canvas c) {
+		c.drawRect(x, y, x+width, y+height, p);
+		c.drawText(text, x+width/2, y+height/2+vOffset, textPaint);
+	} 
+}
Index: src/com/medievaltech/gui/GUIObject.java
===================================================================
--- src/com/medievaltech/gui/GUIObject.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/gui/GUIObject.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,40 @@
+package com.medievaltech.gui;
+
+import android.graphics.*;
+
+public class GUIObject {
+	protected int x, y, width, height;
+	protected Paint p;	//all properties of the object are determined through the paint object
+	
+	public GUIObject(int newX, int newY, int newWidth, int newHeight, Paint p) {
+		x = newX;
+		y = newY;
+		width = newWidth;
+		height = newHeight;
+		this.p = p;
+	}
+	
+	public void draw(Canvas c) {
+
+	}
+	
+	public boolean isClicked(float xCoord, float yCoord) {
+		return x <= xCoord && xCoord <= x+width && y <= yCoord && yCoord <= y+height;
+	}
+	
+	public int getX() {
+		return x;
+	}
+	
+	public int getY() {
+		return y;
+	}
+	
+	public int getWidth() {
+		return width;
+	}
+	
+	public int getHeight() {
+		return height;
+	}
+}
Index: src/com/medievaltech/gui/Text.java
===================================================================
--- src/com/medievaltech/gui/Text.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/gui/Text.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,22 @@
+package com.medievaltech.gui;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+
+public class Text extends GUIObject {
+	private String text;
+	private Paint textPaint;
+	private float vOffset;
+	
+	public Text(String newText, int newX, int newY, int newWidth, int newHeight, Paint textPaint) {
+		super(newX, newY, newWidth, newHeight, null);
+		
+		this.textPaint = textPaint;
+		text = newText;	
+		vOffset = -(textPaint.getFontMetrics().ascent+textPaint.getFontMetrics().descent)/2;
+	}
+	
+	public void draw(Canvas c) {
+		c.drawText(text, x+width/2, y+height/2+vOffset, textPaint);
+	} 
+}
Index: src/com/medievaltech/gui/Window.java
===================================================================
--- src/com/medievaltech/gui/Window.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
+++ src/com/medievaltech/gui/Window.java	(revision abe7b3dfb5b7b3fde546e631b3e04eabb38a0c6d)
@@ -0,0 +1,29 @@
+package com.medievaltech.gui;
+
+import java.util.Hashtable;
+
+import android.graphics.Canvas;
+
+public class Window extends GUIObject {
+	private Hashtable<String, GUIObject> drawableObjects;
+	
+	public Window(int newX, int newY, int newWidth, int newHeight) {
+		super(newX, newY, newWidth, newHeight, null);
+		
+		drawableObjects = new Hashtable<String, GUIObject>();
+	}
+	
+	public void addGUIObject(String name, GUIObject o) {
+		drawableObjects.put(name, o);
+	}
+	
+	public GUIObject getGUIObject(String name) {
+		return drawableObjects.get(name);
+	}
+	
+	public void draw(Canvas c) {
+		for (GUIObject o : drawableObjects.values()) {
+    		o.draw(c);
+    	}
+	}
+}
