de.htwdd.rosenkoenig.gui
Interface GUI

All Known Implementing Classes:
GameLogger, GenutsGUI

public interface GUI

This interface has to be implemented by a "Rosenkoenig-GUI" that wants to show the course of the game. Classes that implement GUI can be added to a Game in order to be notified whenever GUI-events occur.


Method Summary
 void activatePlayer(Color color, boolean activate)
          Activate or deactivate the player's name string.
 void disablePlayer(Color color)
          Disables all controls of a single player.
 void enableDrawDeck(ImageState state)
          Enables / disables the draw deck.
 void enableEndTurn(ImageState state)
          Enables / disables the GUI element that ends a player's turn
 void hideScoreChange(Color player)
          This method tells the GUI to hide a player's score increase.
 void initGUI(Game game, java.lang.String nameRed, java.lang.String nameWhite)
          Use this method to perform initialization.
 void redrawGUI()
          forces the GUI to show all changes taken since the last call of redrawGUI.
 void setBoard(Color[][] board)
          setBoard is called to replace the complete board.
 void setCards(Color color, java.util.List<Card> cards)
          This method is called whenever a player's card deck has changed and sets a player's card deck.
 void setCardState(Color color, ImageState state, int card, boolean knightable)
          setCardState is called whenever a card's state has changed.
 void setCrown(Position position)
          This method is called to specify the position of the crown on the board.
 void setDrawDeck(int number)
          Sets the number of cards left in the draw deck.
 void setKnights(Color color, int number)
          Sets the number of knights a player has left.
 void setKnightState(Color color, ImageState state)
          This method is called whenever a player's knights are enabled or disabled.
 void setPlayedDeck(int number, Card playedCard)
          Sets the number of cards left in the played cards deck.
 void setScore(Color color, int score)
          Updates a player's score.
 void setScoreChange(Color color, int score)
          After the player selects the card he wants to play, the GUI shows the possible score increase.
 void setStone(Color color, Position position, boolean perhaps)
          Sets a stone on the board.
 

Method Detail

initGUI

void initGUI(Game game,
             java.lang.String nameRed,
             java.lang.String nameWhite)
Use this method to perform initialization.

Parameters:
game - the game this GUI belongs to
nameRed - the red player's name
nameWhite - the white player's name
See Also:
Game

redrawGUI

void redrawGUI()
forces the GUI to show all changes taken since the last call of redrawGUI.


setCards

void setCards(Color color,
              java.util.List<Card> cards)
This method is called whenever a player's card deck has changed and sets a player's card deck.

Parameters:
color - player
cards - card deck (up to five cards)

setCardState

void setCardState(Color color,
                  ImageState state,
                  int card,
                  boolean knightable)
setCardState is called whenever a card's state has changed.

Parameters:
color - player
state - enabled, disabled, selected
card - index of the card that will be changed
knightable - if set to true, the selected card is marked knightable

setStone

void setStone(Color color,
              Position position,
              boolean perhaps)
Sets a stone on the board. This method is also called if a stone has changed its color.

Parameters:
color - color of the stone or null to remove the stone
position - the stone's position
perhaps - if set to true, the stone is drawn "misty"

setBoard

void setBoard(Color[][] board)
setBoard is called to replace the complete board.

Parameters:
board - array (dimensions habe to be 9x9) of stones. A color represents a stone, null represents an empty field

setKnights

void setKnights(Color color,
                int number)
Sets the number of knights a player has left.

Parameters:
color - player
number - number of knights left

setKnightState

void setKnightState(Color color,
                    ImageState state)
This method is called whenever a player's knights are enabled or disabled.

Parameters:
color - player
state - enabled, disabled

setScore

void setScore(Color color,
              int score)
Updates a player's score.

Parameters:
color - player
score - new score

disablePlayer

void disablePlayer(Color color)
Disables all controls of a single player.

Parameters:
color - player

activatePlayer

void activatePlayer(Color color,
                    boolean activate)
Activate or deactivate the player's name string. This method is called at the beginning and at the end of each turn.

Parameters:
color - the player's color
activate - whether to activate the player or not

setScoreChange

void setScoreChange(Color color,
                    int score)
After the player selects the card he wants to play, the GUI shows the possible score increase.

Parameters:
color - player
score - score increase

hideScoreChange

void hideScoreChange(Color player)
This method tells the GUI to hide a player's score increase.

Parameters:
player - the player whose score increase is to be hidden

setDrawDeck

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

Parameters:
number - number of cards left

enableDrawDeck

void enableDrawDeck(ImageState state)
Enables / disables the draw deck.

Parameters:
state - enabled or disabled

setPlayedDeck

void setPlayedDeck(int number,
                   Card playedCard)
Sets the number of cards left in the played cards deck.

Parameters:
number - number of cards left
playedCard - the card that was played last

enableEndTurn

void enableEndTurn(ImageState state)
Enables / disables the GUI element that ends a player's turn

Parameters:
state - enabled or disabled

setCrown

void setCrown(Position position)
This method is called to specify the position of the crown on the board.

Parameters:
position - the crown's position