Allow reenabling of piecen placement and paint a white rectangle around

the last placed tile.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@369 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-10-18 02:17:30 +00:00
parent aa148ebf00
commit d520132440
@@ -1,5 +1,5 @@
//
// $Id: AtlantiBoard.java,v 1.10 2001/10/17 23:27:52 mdb Exp $
// $Id: AtlantiBoard.java,v 1.11 2001/10/18 02:17:30 mdb Exp $
package com.threerings.venison;
@@ -111,6 +111,9 @@ public class VenisonBoard
// add the tile
_tiles.add(tile);
// reference this as our most recently placed tile
_lastPlacedTile = tile;
// resort the list
Collections.sort(_tiles);
@@ -185,6 +188,15 @@ public class VenisonBoard
_placingPiecen = false;
}
/**
* If we freed up a placeable piecen that we didn't have when we
* placed our tile, this can be called to reenable piecen placement.
*/
public void enablePiecenPlacement ()
{
_placingPiecen = true;
}
/**
* Sets the tile to be placed on the board. The tile will be displayed
* in the square under the mouse cursor where it can be legally placed
@@ -272,6 +284,14 @@ public class VenisonBoard
g.drawRect(sx, sy, TILE_WIDTH, TILE_HEIGHT);
}
// draw a white rectangle around the last placed
if (_lastPlacedTile != null) {
g.setColor(Color.white);
int sx = (_lastPlacedTile.x + _origX) * TILE_WIDTH;
int sy = (_lastPlacedTile.y + _origY) * TILE_HEIGHT;
g.drawRect(sx, sy, TILE_WIDTH, TILE_HEIGHT);
}
// undo our translations
g.translate(-_tx, -_ty);
@@ -600,6 +620,9 @@ public class VenisonBoard
/** The last tile being placed by the user. */
protected VenisonTile _placedTile;
/** The last tile placed on the board via {@link #addTile}. */
protected VenisonTile _lastPlacedTile;
/** A flag indicating whether or not we're placing a piecen. */
protected boolean _placingPiecen = false;