Changes in / [90838a1:c088db6] in advance-wars
- Location:
- src/com/example/advancewars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/advancewars/Game.java
r90838a1 rc088db6 53 53 break; 54 54 case MENU_NEW: 55 if(mThread.mGameState == GameState.COMP_TURN) 56 mGameView.newRound(); 55 57 break; 56 58 } -
src/com/example/advancewars/GameState.java
r90838a1 rc088db6 2 2 3 3 public enum GameState { 4 MAIN_MENU,5 BATTLE_MAP4 YOUR_TURN, 5 COMP_TURN 6 6 } -
src/com/example/advancewars/GameView.java
r90838a1 rc088db6 105 105 } 106 106 107 mGameState = GameState. MAIN_MENU;107 mGameState = GameState.YOUR_TURN; 108 108 } 109 109 … … 117 117 setState(AppState.RUNNING); 118 118 Log.i("Blackjack", "Player's turn starting now"); 119 mGameState = GameState. MAIN_MENU;119 mGameState = GameState.YOUR_TURN; 120 120 } 121 121 } … … 314 314 canvas.drawColor(Color.BLACK); 315 315 316 String text;316 mTextPaint.setTextSize(12); 317 317 Paint.FontMetrics metrics = mTextPaint.getFontMetrics(); 318 318 319 switch(mGameState) { 320 case MAIN_MENU: 321 text = "Main Menu"; 322 canvas.drawText(text, 0, 450-(metrics.ascent+metrics.descent)/2, mTextPaint); 323 break; 324 case BATTLE_MAP: 325 mTextPaint.setTextSize(12); 326 327 mMap.draw(canvas, 10, 25); 328 329 text = "Advance Wars grid test"; 330 canvas.drawText(text, 0, 450-(metrics.ascent+metrics.descent)/2, mTextPaint); 331 break; 332 } 319 mMap.draw(canvas, 10, 25); 320 321 String text = "Advance Wars grid test"; 322 canvas.drawText(text, 0, 450-(metrics.ascent+metrics.descent)/2, mTextPaint); 333 323 } 334 324 … … 379 369 setFocusable(true); // make sure we get key events 380 370 } 371 372 public void newRound() { 373 thread.mGameState = GameState.YOUR_TURN; 374 } 381 375 382 376 @Override public boolean onTouchEvent(MotionEvent event) { … … 386 380 Log.i("Blackjack", "Detected UP touch action"); 387 381 switch(thread.mGameState) { 388 case MAIN_MENU: 389 Log.i("Blackjack", "Switching to battle map"); 390 thread.mGameState = GameState.BATTLE_MAP; 382 case YOUR_TURN: 383 Log.i("Blackjack", "Player's turn"); 391 384 break; 392 case BATTLE_MAP:393 Log.i("Blackjack", " Touch event detected on battle map");385 case COMP_TURN: 386 Log.i("Blackjack", "Computer's turn"); 394 387 break; 395 388 }
Note:
See TracChangeset
for help on using the changeset viewer.