|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.genuts.gameui.Sprite
com.genuts.gameui.SpriteWrapper
de.htwdd.rosenkoenig.gui.genuts.GUICard
public class GUICard
This class represents a card belonging to a player's card deck. The card consists of a blue/white
background and a sword. The sword can point to 8 different directions and can have between one
and three rings around it's blade. If the player intends to play a card, he has to click it.
In state SELECTED the rings rotate around the blade.
| Field Summary | |
|---|---|
private ImageSequenceSprite |
background
|
private Card |
card
|
private Sprite |
flower
|
private static int |
FLOWER_OFFSET
|
private Game |
game
|
private java.util.EnumMap<ImageState,java.awt.Image> |
imgBacks
|
private java.util.EnumMap<ImageState,java.awt.Image> |
imgSwords
|
private PlayField |
playfield
|
private ImageState |
state
|
private AnimatedSprite |
sword
|
private static int |
VARIATION
|
| Constructor Summary | |
|---|---|
GUICard(Card card,
Game game,
PlayField playfield,
Color color)
Creates and initializes a GUICard |
|
| Method Summary | |
|---|---|
void |
click(java.awt.event.MouseEvent event)
select a card |
boolean |
isSpriteAt(int x,
int y)
both sword and background shall be clickable |
void |
remove()
removes all sprites from the playfield |
void |
setCardState(ImageState state)
sets the card's state |
void |
setKnightable(boolean knightable)
Puts a small flower to the upper right or left edge of the card to indicate that this card is only playable by using a knight. |
boolean |
setPosition(int x,
int y)
Positions the card on the playfield, adds a random offset to the specified position. |
| 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 |
|---|
private static final int VARIATION
private static final int FLOWER_OFFSET
private java.util.EnumMap<ImageState,java.awt.Image> imgBacks
private java.util.EnumMap<ImageState,java.awt.Image> imgSwords
private PlayField playfield
private ImageSequenceSprite background
private AnimatedSprite sword
private Sprite flower
private ImageState state
private Game game
private Card card
| Constructor Detail |
|---|
public GUICard(Card card,
Game game,
PlayField playfield,
Color color)
card - the logical representation of this cardgame - the game this card belongs toplayfield - the playfield this card belongs tocolor - the card's color (red or white)| Method Detail |
|---|
public void setCardState(ImageState state)
state - disabled, enabled or selectedpublic void setKnightable(boolean knightable)
knightable -
public boolean setPosition(int x,
int y)
setPosition in class SpriteWrapperx - x positiony - y position
public boolean isSpriteAt(int x,
int y)
isSpriteAt in class SpriteWrapperpublic void remove()
public void click(java.awt.event.MouseEvent event)
click in interface Clickable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||