Changeset dd3e793 in advance-wars for src/com/example/advancewars/GameView.java
- Timestamp:
- Jan 30, 2011, 7:11:12 PM (14 years ago)
- Branches:
- master
- Children:
- 90838a1
- Parents:
- 681c37d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/advancewars/GameView.java
r681c37d rdd3e793 105 105 } 106 106 107 mGameState = GameState. YOUR_TURN;107 mGameState = GameState.MAIN_MENU; 108 108 } 109 109 … … 117 117 setState(AppState.RUNNING); 118 118 Log.i("Blackjack", "Player's turn starting now"); 119 mGameState = GameState. YOUR_TURN;119 mGameState = GameState.MAIN_MENU; 120 120 } 121 121 } … … 314 314 canvas.drawColor(Color.BLACK); 315 315 316 mTextPaint.setTextSize(12);316 String text; 317 317 Paint.FontMetrics metrics = mTextPaint.getFontMetrics(); 318 318 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); 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 } 323 333 } 324 334 … … 369 379 setFocusable(true); // make sure we get key events 370 380 } 371 372 public void newRound() {373 thread.mGameState = GameState.YOUR_TURN;374 }375 381 376 382 @Override public boolean onTouchEvent(MotionEvent event) { … … 380 386 Log.i("Blackjack", "Detected UP touch action"); 381 387 switch(thread.mGameState) { 382 case YOUR_TURN: 383 Log.i("Blackjack", "Player's turn"); 388 case MAIN_MENU: 389 Log.i("Blackjack", "Switching to battle map"); 390 thread.mGameState = GameState.BATTLE_MAP; 384 391 break; 385 case COMP_TURN:386 Log.i("Blackjack", " Computer's turn");392 case BATTLE_MAP: 393 Log.i("Blackjack", "Touch event detected on battle map"); 387 394 break; 388 395 }
Note:
See TracChangeset
for help on using the changeset viewer.