de.htwdd.rosenkoenig.gui.genuts
Class DrawDeck

java.lang.Object
  extended by com.genuts.gameui.Sprite
      extended by com.genuts.gameui.SpriteWrapper
          extended by de.htwdd.rosenkoenig.gui.genuts.DrawDeck
All Implemented Interfaces:
Tickable, Clickable, java.lang.Cloneable

public class DrawDeck
extends SpriteWrapper
implements Clickable

This class represents the draw deck. Whenever the user intends to draw a card, he has to click the draw deck. The draw deck shows a red cross if it is empty, a click forces the game to shuffle the cards and refill the deck.


Field Summary
private  ImageSequenceSprite deck
           
private  Game game
           
private  java.util.EnumMap<ImageState,java.awt.Image> images
           
private  Sprite selection
           
private  ImageState state
           
 
Constructor Summary
DrawDeck(Game game, PlayField playfield)
          Creates a new DrawDeck.
 
Method Summary
 void click(java.awt.event.MouseEvent event)
          draw a card
 void setDrawDeck(int numCards)
          Sets the number of cards left in the deck.
 boolean setPosition(int x, int y)
           
 void setState(ImageState state)
          Sets the deck's state.
 
Methods inherited from class com.genuts.gameui.SpriteWrapper
checkCollision, cloneSprite, collisionWith, getActionSprite, getBackground, getBottomCollisionOffset, getBounds, getFinalActionSprite, getHeight, getId, getImage, getLeftCollisionOffset, getParent, getPosition, getRightCollisionOffset, getRotation, getSize, getTopCollisionOffset, getWidth, getX, getY, invalidate, isBackgroundSprite, isPremode, isSpriteAt, isValidate, isVisible, paint, preCollisionWith, repaint, setActionSprite, setBackground, setBackgroundSprite, setBottomCollisionOffset, setBounds, setBounds, setId, setImage, setLeftCollisionOffset, setParent, setPremode, setRightCollisionOffset, setRotation, setSize, setTopCollisionOffset, setVisible, tick, validate
 
Methods inherited from class com.genuts.gameui.Sprite
getFinalWrapper, getWrapper, setWrapper, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

images

private java.util.EnumMap<ImageState,java.awt.Image> images

deck

private ImageSequenceSprite deck

state

private ImageState state

selection

private Sprite selection

game

private Game game
Constructor Detail

DrawDeck

public DrawDeck(Game game,
                PlayField playfield)
Creates a new DrawDeck.

Parameters:
game - the game this deck belongs to
playfield - the parent playfield
Method Detail

setDrawDeck

public void setDrawDeck(int numCards)
Sets the number of cards left in the deck.

Parameters:
numCards - number of cards

setState

public void setState(ImageState state)
Sets the deck's state.

Parameters:
state - enabled or disabled

setPosition

public boolean setPosition(int x,
                           int y)
Overrides:
setPosition in class SpriteWrapper

click

public void click(java.awt.event.MouseEvent event)
draw a card

Specified by:
click in interface Clickable