Changeset b97a618 in advance-wars for src/com/medievaltech/advancewars/GameView.java
- Timestamp:
- Feb 2, 2011, 4:51:03 PM (14 years ago)
- Branches:
- master
- Children:
- 78d3c6f
- Parents:
- 6a639f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/medievaltech/advancewars/GameView.java
r6a639f7 rb97a618 61 61 private com.medievaltech.gui.Window wndMainMenu, wndBattleMap; 62 62 private Unit selectedUnit; 63 private boolean test = false;64 63 65 64 public DrawingThread(SurfaceHolder surfaceHolder, Context context, Handler handler) { … … 111 110 Tile oceanTile = new Tile(mTilePaint2); 112 111 113 mMap = new Map(grassTile, 6, 8 );112 mMap = new Map(grassTile, 6, 8, new Point(10, 25)); 114 113 115 114 boolean land = true; … … 127 126 128 127 mMap.getTile(2, 3).addUnit(new Soldier(mUnitPaint)); 129 mMap.getTile(5, 7).addUnit(new Soldier(mUnitPaint)); 130 131 selectedUnit = mMap.getTile(2, 3).currentUnit; 128 mMap.getTile(5, 6).addUnit(new Soldier(mUnitPaint)); 132 129 133 130 mGameState = GameState.MAIN_MENU; … … 350 347 mTextPaint.setTextSize(12); 351 348 352 mMap.draw(canvas , 10, 25);349 mMap.draw(canvas); 353 350 354 for(Point p : selectedUnit.getMovementRange()) {355 canvas.drawRect(p.x*50+10, p.y*50+25, p.x*50+50+10, p.y*50+50+25, mSelectionPaint); 356 if(!test) 357 Log.i("AdvanceWars", "("+p.x+","+p.y+")"); 351 if(selectedUnit != null) { 352 for(Point p : selectedUnit.getMovementRange()) { 353 canvas.drawRect(p.x*50+10, p.y*50+25, p.x*50+50+10, p.y*50+50+25, mSelectionPaint); 354 } 358 355 } 359 test = true;360 356 361 text = "Advance Wars grid test";362 canvas.drawText(text, 0, 450-(metrics.ascent+metrics.descent)/2, mTextPaint);357 mMap.drawUnits(canvas); 358 363 359 break; 364 360 } … … 432 428 case BATTLE_MAP: 433 429 Log.i("AdvanceWars", "Touch event detected on battle map"); 434 thread.mGameState = GameState.MAIN_MENU; 430 431 if(event.getX() >= thread.mMap.offset.x && event.getY() >= thread.mMap.offset.y) { 432 int x = ((int)event.getX() - thread.mMap.offset.x) / 50; 433 int y = ((int)event.getY() - thread.mMap.offset.y) / 50; 434 435 thread.selectedUnit = thread.mMap.getTile(x, y).currentUnit; 436 } 437 435 438 break; 436 439 }
Note:
See TracChangeset
for help on using the changeset viewer.