Changeset 3a0d468 in galcon-client
- Timestamp:
- Jun 20, 2010, 6:29:03 PM (15 years ago)
- Branches:
- master
- Children:
- a4f5200, b87af8a
- Parents:
- 9d030cb
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
AndroidManifest.xml
r9d030cb r3a0d468 11 11 </application> 12 12 <uses-sdk android:minSdkVersion="7" /> 13 <uses-permission android:name="android.permission.INTERNET" /> 13 14 </manifest> -
res/values/strings.xml
r9d030cb r3a0d468 8 8 <string name="menu_pause">Pause</string> 9 9 <string name="menu_resume">Resume</string> 10 <string name="menu_easy">Easy</string> 11 <string name="menu_medium">Medium</string> 12 <string name="menu_hard">Hard</string> 10 <string name="menu_connect">Connect</string> 13 11 14 12 <string name="mode_ready">Lunar Lander\nPress Up To Play</string> -
src/com/example/helloandroid/Game.java
r9d030cb r3a0d468 11 11 12 12 public class Game extends Activity { 13 private static final int MENU_EASY = 1; 14 15 private static final int MENU_HARD = 2; 16 17 private static final int MENU_MEDIUM = 3; 18 19 private static final int MENU_PAUSE = 4; 20 21 private static final int MENU_RESUME = 5; 22 23 private static final int MENU_START = 6; 24 25 private static final int MENU_STOP = 7; 13 private static final int MENU_PAUSE = 1; 14 private static final int MENU_RESUME = 2; 15 private static final int MENU_START = 3; 16 private static final int MENU_STOP = 4; 17 private static final int MENU_CONNECT = 5; 26 18 27 19 /** A handle to the thread that's actually running the animation. */ 28 p rivateDrawingThread mThread;20 public DrawingThread mThread; 29 21 30 22 /** A handle to the View in which the game is running. */ 31 23 private GameView mGameView; 32 24 25 private ClientThread client; 26 33 27 /** 34 28 * Invoked during init to give the Activity a chance to set up its Menu. … … 45 39 menu.add(0, MENU_PAUSE, 0, R.string.menu_pause); 46 40 menu.add(0, MENU_RESUME, 0, R.string.menu_resume); 47 menu.add(0, MENU_EASY, 0, R.string.menu_easy); 48 menu.add(0, MENU_MEDIUM, 0, R.string.menu_medium); 49 menu.add(0, MENU_HARD, 0, R.string.menu_hard); 41 menu.add(0, MENU_CONNECT, 0, R.string.menu_connect); 50 42 51 43 return true; … … 66 58 return true; 67 59 case MENU_STOP: 68 mThread.setState(DrawingThread.STATE_LOSE, 69 getText(R.string.message_stopped)); 60 mThread.setState(DrawingThread.STATE_LOSE, getText(R.string.message_stopped)); 70 61 return true; 71 62 case MENU_PAUSE: … … 75 66 mThread.unpause(); 76 67 return true; 68 case MENU_CONNECT: 69 mThread.connectionStarted = true; 70 client = new ClientThread("192.168.1.6", 1337, this); 71 client.start(); 72 mThread.doStart(); 73 return true; 77 74 } 78 75 -
src/com/example/helloandroid/GameView.java
r9d030cb r3a0d468 81 81 82 82 int mFleetSize; 83 84 public boolean connectionStarted; 85 public String connMessage; 83 86 84 87 public DrawingThread(SurfaceHolder surfaceHolder, Context context, … … 107 110 108 111 mFleetSize = 50; 112 113 connectionStarted = false; 114 connMessage = ""; 109 115 } 110 116 … … 346 352 } 347 353 } 348 354 355 //draw the fleet size bar on the bottom of the screen 349 356 float textSize = mTextPaint.getTextSize(); 350 357 mTextPaint.setTextSize(24); … … 355 362 356 363 mTextPaint.setTextSize(textSize); 357 364 358 365 mLinePaint.setColor(Color.YELLOW); 359 366 canvas.drawRoundRect(new RectF(70, mCanvasHeight-15, mCanvasWidth-70, mCanvasHeight-5), 5, 5, mLinePaint); … … 361 368 mLinePaint.setColor(Color.GREEN); 362 369 canvas.drawRoundRect(new RectF(70, mCanvasHeight-15, 70+(mCanvasWidth-140)*mFleetSize/100, mCanvasHeight-5), 5, 5, mLinePaint); 370 371 //draw connection info 372 if(connectionStarted) { 373 canvas.drawText(connMessage, (mCanvasWidth-mTextPaint.measureText(connMessage))/2, mCanvasHeight-200-(metrics.ascent+metrics.descent), mTextPaint); 374 } 363 375 } 364 376
Note:
See TracChangeset
for help on using the changeset viewer.