Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gecco.client
Class Game

    java.lang.Object
      java.awt.Component
          java.awt.Container
              java.awt.Window
                  java.awt.Frame
                      javax.swing.JFrame
                          gecco.client.Game

All Implemented Interfaces:
  Accessible, Animator, Client, ImageObserver, MenuContainer, RootPaneContainer, Serializable, WindowConstants

public class Game
extends JFrame
implements Client, Animator

This is the main game class. It contains the complete client for an arbitrary game.

Author:
  Andreas Enblom
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JFrame
`JFrame.AccessibleJFrame`

Nested classes inherited from class java.awt.Frame
`Frame.AccessibleAWTFrame`

Nested classes inherited from class java.awt.Window
`Window.AccessibleAWTWindow`

Nested classes inherited from class java.awt.Container
`Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy`

Field Summary

Fields inherited from class javax.swing.JFrame
`accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled`

Fields inherited from class java.awt.Frame
`CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface javax.swing.WindowConstants
`DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`Game(String gameTitle)` Constructor for the Game object

Method Summary
`void` | `abortAllActions(int pieceHandle)`
`void` | `abortExecutingAction(Piece p)` Aborts the currently executing action of the given piece.
`void` | `abortExecutingAction(Piece p, boolean abortAll)` Aborts the currently executing action of the given piece.
`void` | `actionReply(long id, boolean ok)` Description of the Method
`void` | `addPiece(int handle, String name, Position pos, Set actions, Map properties, String type)` Adds the specified piece, as described in Client.java.
`void` | `addPieceAction(int handle, Action a)` Adds a feature to the PieceAction attribute of the Game object
`void` | `animationDone(AnimatedPiece p)` Description of the Method
`void` | `coffeeBreak(String message)`
`void` | `connectionLost()` Description of the Method
`void` | `destroyPiece(int handle)` Description of the Method
`void` | `gameOver(String message)`
`Piece` | `getPieceAt(Point point)` Returns the piece at the given point of the board, or null if no such piece exists.
`Enumeration` | `getPiecePositions(Piece piece)`
`Enumeration` | `getPiecesIntersecting(Rectangle rect)` Returns all pieces of the game that intersect the given rectangle.
`Position` | `getPreferredCenter()` Returns the preferred center of the map.
`Enumeration` | `getSelectedPiecePositions()` Returns the positions of the queued actions (and the currently executing action) of the selected piece, or NULL if no piece is selected.
`void` | `hideMapPoint(Point p)` Makes an automaton in the map invisible.
`void` | `hideMapPoints(Point[] points)` Makes a number of automatons invisible.
`static void` | `main(String[] argv)` Main method for program start.
`void` | `mapLoadingProgressUpdate(double progress)` Description of the Method
`void` | `mapUpdate(Point[] points, int[] colors)` Description of the Method
`void` | `mapUpdate(Point p, int color)` Description of the Method
`protected void` | `playAudioClip(AudioClip clip)`
`void` | `removePiece(int handle)` Description of the Method
`void` | `removePieceAction(int handle, Action a)` Description of the Method
`void` | `repaintAnimation(AnimatedPiece p)` Description of the Method
`void` | `timeUpdate(String time)` Description of the Method
`void` | `unitMessage(int handle, String message)` Description of the Method
`void` | `updatePiece(int handle, Position newPosition)` Description of the Method
`void` | `updatePiece(int handle, Property[] newProperties)` Description of the Method
`void` | `warningMessage(String message)`

Methods inherited from class javax.swing.JFrame
`addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update`

Methods inherited from class java.awt.Frame
`addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated`

Methods inherited from class java.awt.Window
`addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.awt.MenuContainer
`getFont, postEvent`

Constructor Detail

### Game

    public Game(String gameTitle)

  Constructor for the Game object

Parameters:
  `gameTitle` - Description of Parameter

Method Detail

### playAudioClip

    protected void playAudioClip(AudioClip clip)

### getPieceAt

    public Piece getPieceAt(Point point)

  Returns the piece at the given point of the board, or null if no such piece exists.

  Parameters:
    `point` - Description of Parameter
  Returns:
    The PieceAt value

### getPiecesIntersecting

    public Enumeration getPiecesIntersecting(Rectangle rect)

  Returns all pieces of the game that intersect the given rectangle. The rectangle is in actual screen coordinates, relative to the component of the board where the map and the pieces are painted.

  Parameters:
    `rect` - Description of Parameter
  Returns:
    The PiecesIntersecting value

### getPreferredCenter

    public Position getPreferredCenter()

  Returns the preferred center of the map. This is the center of the current screen or, if there is a selected piece, the position of the selected piece. The preferred center is the center around which the board will zoom in and out.

  Returns:
    The preferred center of the map.

### getSelectedPiecePositions

    public Enumeration getSelectedPiecePositions()

  Returns the positions of the queued actions (and the currently executing action) of the selected piece, or NULL if no piece is selected. The position of an action is the position of its argument (if any). The collection points is started with the position of the selected piece.

  Returns:
    The SelectedPiecePositions value

### getPiecePositions

    public Enumeration getPiecePositions(Piece piece)

### mapUpdate

    public void mapUpdate(Point[] points,
                          int[] colors)

  Description of the Method

  Specified by:
    `mapUpdate` in interface `Client`
  Parameters:
    `points` - Description of Parameter
    `colors` - Description of Parameter

### mapUpdate

    public void mapUpdate(Point p,
                          int color)

  Description of the Method

  Specified by:
    `mapUpdate` in interface `Client`
  Parameters:
    `p` - Description of Parameter
    `color` - Description of Parameter

### hideMapPoints

    public void hideMapPoints(Point[] points)

  Makes a number of automatons invisible.

  Specified by:
    `hideMapPoints` in interface `Client`
  Parameters:
    `points` - A vector of automaton coordinates.

### hideMapPoint

    public void hideMapPoint(Point p)

  Makes an automaton in the map invisible.

  Specified by:
    `hideMapPoint` in interface `Client`
  Parameters:
    `p` - The coordinate of the automaton.

### unitMessage

    public void unitMessage(int handle,
                            String message)

  Description of the Method

  Specified by:
    `unitMessage` in interface `Client`
  Parameters:
    `handle` - Description of Parameter
    `message` - Description of Parameter

### timeUpdate

    public void timeUpdate(String time)

  Description of the Method

  Specified by:
    `timeUpdate` in interface `Client`
  Parameters:
    `time` - Description of Parameter

### warningMessage

    public void warningMessage(String message)

### addPiece

    public void addPiece(int handle,
                         String name,
                         Position pos,
                         Set actions,
                         Map properties,
                         String type)

  Adds the specified piece, as described in Client.java. If there is a ghost piece with the same type and position, that ghost piece will be removed and replaced with the new piece. If the ghost is selected, the selection will carry over to the new piece.

  Specified by:
    `addPiece` in interface `Client`
  Parameters:
    `handle` - The feature to be added to the Piece attribute
    `name` - The feature to be added to the Piece attribute
    `pos` - The feature to be added to the Piece attribute
    `actions` - The feature to be added to the Piece attribute
    `properties` - The feature to be added to the Piece attribute
    `type` - The feature to be added to the Piece attribute

### updatePiece

    public void updatePiece(int handle,
                            Property[] newProperties)

  Description of the Method

  Specified by:
    `updatePiece` in interface `Client`
  Parameters:
    `handle` - Description of Parameter
    `newProperties` - Description of Parameter

### updatePiece

    public void updatePiece(int handle,
                            Position newPosition)

  Description of the Method

  Specified by:
    `updatePiece` in interface `Client`
  Parameters:
    `handle` - Description of Parameter
    `newPosition` - Description of Parameter

### removePiece

    public void removePiece(int handle)

  Description of the Method

  Specified by:
    `removePiece` in interface `Client`
  Parameters:
    `handle` - Description of Parameter

### destroyPiece

    public void destroyPiece(int handle)

  Description of the Method

  Specified by:
    `destroyPiece` in interface `Client`
  Parameters:
    `handle` - Description of Parameter

### addPieceAction

    public void addPieceAction(int handle,
                               Action a)

  Adds a feature to the PieceAction attribute of the Game object

  Specified by:
    `addPieceAction` in interface `Client`
  Parameters:
    `handle` - The feature to be added to the PieceAction attribute
    `a` - The feature to be added to the PieceAction attribute

### removePieceAction

    public void removePieceAction(int handle,
                                  Action a)

  Description of the Method

  Specified by:
    `removePieceAction` in interface `Client`
  Parameters:
    `handle` - Description of Parameter
    `a` - Description of Parameter

### actionReply

    public void actionReply(long id,
                            boolean ok)

  Description of the Method

  Specified by:
    `actionReply` in interface `Client`
  Parameters:
    `id` - Description of Parameter
    `ok` - Description of Parameter

### connectionLost

    public void connectionLost()

  Description of the Method

  Specified by:
    `connectionLost` in interface `Client`

### mapLoadingProgressUpdate

    public void mapLoadingProgressUpdate(double progress)

  Description of the Method

  Specified by:
    `mapLoadingProgressUpdate` in interface `Client`
  Parameters:
    `progress` - Description of Parameter

### abortAllActions

    public void abortAllActions(int pieceHandle)

  Specified by:
    `abortAllActions` in interface `Client`

### repaintAnimation

    public void repaintAnimation(AnimatedPiece p)

  Description of the Method

  Specified by:
    `repaintAnimation` in interface `Animator`
  Parameters:
    `p` - Description of Parameter

### animationDone

    public void animationDone(AnimatedPiece p)

  Description of the Method

  Specified by:
    `animationDone` in interface `Animator`
  Parameters:
    `p` - Description of Parameter

### abortExecutingAction

    public void abortExecutingAction(Piece p,
                                     boolean abortAll)

  Aborts the currently executing action of the given piece. Optionally, all queued actions are aborted, if not the next action in queue is executed.

  Parameters:
    `p` - The piece.
    `abortAll` - Indiactes whether or not all executing actions should be aborted.

### abortExecutingAction

    public void abortExecutingAction(Piece p)

  Aborts the currently executing action of the given piece. The next action in queue is then executed.

  Parameters:
    `p` - Description of Parameter

### gameOver

    public void gameOver(String message)

  Specified by:
    `gameOver` in interface `Client`

### coffeeBreak

    public void coffeeBreak(String message)

  Specified by:
    `coffeeBreak` in interface `Client`

### main

    public static void main(String[] argv)

  Main method for program start.

  Parameters:
    `argv` - The command line arguments

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD