Class HandMetrics

All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, PropertyNameSource, ValidityChecker, Translatable, Auditable, ImageSearchTarget, SearchTarget

public class HandMetrics extends StackMetrics
Handles the drawing of cards in a PlayerHand. Lays out the cards horizontally with no overlap and even spacing.
  • Constructor Details

    • HandMetrics

      public HandMetrics()
  • Method Details

    • draw

      public void draw(Stack stack, Graphics g, int x, int y, Component obs, double zoom)
      Description copied from class: StackMetrics
      Different instances of StackMetrics may render a Stack in different ways. The default algorithm is: If not expanded, all but the top visible GamePiece is drawn as a white square with size given by GamePiece.getShape(). The separation between GamePieces is given by StackMetrics.relativePosition(Stack, GamePiece) If expanded, all GamePieces are drawn with separation given by StackMetrics.relativePosition(Stack, GamePiece). GamePiece that are selected are drawn in front of other GamePieces, even those above them in the stack.
      Overrides:
      draw in class StackMetrics
    • draw

      public void draw(Stack stack, Point location, Graphics g, Map map, double zoom, Rectangle visibleRect)
      Description copied from class: StackMetrics
      Draw only those pieces in the target stack whose boundingBoxes fall within the given visibleRect This method is considerably faster than the other draw method.
      Overrides:
      draw in class StackMetrics
      Parameters:
      stack -
      location - the location of the stack in component coordinates
      g -
      zoom -
      visibleRect - the visible rectangle in component coordinates
    • nextPosition

      protected void nextPosition(Point currentPos, Rectangle currentBounds, Point nextPos, Rectangle nextBounds, int dx, int dy)
      Overrides:
      nextPosition in class StackMetrics
    • merge

      public Command merge(GamePiece fixed, GamePiece moving)
      Description copied from class: StackMetrics
      Place a GamePiece on top of another GamePiece Create/remove stacks as necessary, even if stacking is disabled for this instance
      Overrides:
      merge in class StackMetrics
      Parameters:
      fixed - the GamePiece defining the location and contents of the existing stack
      moving - the GamePiece that will be merged into the stack
      Returns:
      a Command that accomplishes this task