ch.aplu.jcardgame
Class CardGame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by ch.aplu.jgamegrid.GameGrid
              extended by ch.aplu.jcardgame.CardGame
All Implemented Interfaces:
GGActListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class CardGame
extends GameGrid

A specialized GameGrid class used for card games.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.aplu.jgamegrid.GameGrid
GameGrid.ClosingMode
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class ch.aplu.jgamegrid.GameGrid
AskOnClose, bgColor, bgImagePath, bgImagePosX, bgImagePosY, BLACK, BLUE, cellSize, CYAN, DARKGRAY, DisposeOnClose, GRAY, GREEN, gridColor, LIGHTGRAY, MAGENTA, monitor, nbHorzCells, nbRotSprites, nbVertCells, NothingOnClose, PINK, RED, simulationPeriod, TerminateOnClose, TRANSPARENT, WHITE, YELLOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CardGame()
          Constructs the game playground with 10 by 10 cells (60 pixels wide).
CardGame(int width, int height)
          Same as CardGame(width, height, bgColor, statusHeight, simulationPeriod) with bgColor = RGB(20, 80, 0) (dark green), simulationPeriod = 30 and statusHeight = 0 (no status bar).
CardGame(int width, int height, java.awt.Color bgColor)
          Same as CardGame(width, height, bgColor, statusHeight, simulationPeriod) with simulationPeriod = 30 and statusHeight = 0 (no status bar).
CardGame(int width, int height, java.awt.Color bgColor, int statusHeight, int simulationPeriod)
          Constructs and shows a game grid window with the given horizontal and vertical pixel size (cell size = 1, no navigation bar).
CardGame(int width, int height, int statusHeight)
          Same as CardGame(width, height, bgColor, statusHeight, simulationPeriod) with bgColor = RGB(20, 80, 0) (dark green), simulationPeriod = 30.
 
Method Summary
 
Methods inherited from class ch.aplu.jgamegrid.GameGrid
act, actAll, activate, addActListener, addActor, addActor, addActor, addActorNoRefresh, addActorNoRefresh, addExitListener, addKeyListener, addKeyRepeatListener, addMouseListener, addNavigationListener, addResetListener, addStatusBar, addWindowStateListener, createTileMap, delay, dispose, disposeAll, doPause, doReset, doRun, doStep, getActors, getActors, getActorsAt, getActorsAt, getAreaSize, getBg, getBgColor, getBgImagePath, getBgImagePos, getBgImagePosX, getBgImagePosY, getCellSize, getClosingMode, getDiagonalLocations, getDoubleClickDelay, getEmptyLocations, getFrame, getGridColor, getImage, getKeyChar, getKeyCharWait, getKeyCode, getKeyCodeWait, getKeyModifiers, getKeyModifiersText, getLineLocations, getMouseLocation, getNbCycles, getNbHorzCells, getNbHorzPix, getNbVertCells, getNbVertPix, getNumberOfActors, getNumberOfActors, getNumberOfActorsAt, getNumberOfActorsAt, getOccupiedLocations, getOneActor, getOneActorAt, getOneActorAt, getPaintOrderList, getPaintOrderList, getPanel, getPanel, getPgHeight, getPgWidth, getPosition, getPressedKeyCodes, getRandomDirection, getRandomEmptyLocation, getRandomLocation, getSimulationPeriod, getStackTrace, getTileMap, getTouchedActors, getVersion, hide, isActorColliding, isAtBorder, isDisposed, isEmpty, isInGrid, isKeyPressed, isPaused, isRunning, isShown, isTileColliding, isUndecorated, kbhit, paint, playLoop, playLoop, playLoop, playLoop, playLoopExt, playLoopExt, playSound, playSound, playSound, playSound, playSoundExt, playSoundExt, refresh, removeActor, removeActors, removeActorsAt, removeActorsAt, removeAllActors, removeKeyListener, removeKeyRepeatListener, removeMouseListener, reset, reverseSceneOrder, setActEnabled, setActOrder, setActorOnBottom, setActorOnTop, setBgColor, setBgColor, setBgImagePath, setBgImagePos, setBgImagePosX, setBgImagePosY, setCellSize, setClosingMode, setDoubleClickDelay, setGridColor, setKeyRepeatPeriod, setMouseEnabled, setNbHorzCells, setNbVertCells, setPaintOrder, setPosition, setSceneOrder, setSimulationPeriod, setStatusText, setStatusText, setTitle, shiftSceneOrder, show, showStatusBar, stopGameThread, toLocation, toLocation, toLocationInGrid, toLocationInGrid, toPoint
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CardGame

public CardGame()
Constructs the game playground with 10 by 10 cells (60 pixels wide). No surrounding frame window is created. Only to be used for a embedded playground in a user defined frame window or an applet. To initialize the playground, use the GameGrid initializer methods, e.g.

CardGame cg = new CardGame();
cg.setCellSize(1);
cg.setNbHorzCells(600);
cg.setNbVertCells(600);
cg.setSimulationPeriod(30);
cg.setBgColor(new Color(20, 80, 0));
cg.doRun();


All card animation must be performed in an own worker thread that runs after the constructor has finished.


CardGame

public CardGame(int width,
                int height)
Same as CardGame(width, height, bgColor, statusHeight, simulationPeriod) with bgColor = RGB(20, 80, 0) (dark green), simulationPeriod = 30 and statusHeight = 0 (no status bar).

Parameters:
width - the horizontal pixel size of the game grid window
height - the vertical pixel size of the game grid window

CardGame

public CardGame(int width,
                int height,
                int statusHeight)
Same as CardGame(width, height, bgColor, statusHeight, simulationPeriod) with bgColor = RGB(20, 80, 0) (dark green), simulationPeriod = 30.

Parameters:
width - the horizontal pixel size of the game grid window
height - the vertical pixel size of the game grid window
statusHeight - the height of the status bar in pixels; if less or equal zero, no status bar is displayed

CardGame

public CardGame(int width,
                int height,
                java.awt.Color bgColor)
Same as CardGame(width, height, bgColor, statusHeight, simulationPeriod) with simulationPeriod = 30 and statusHeight = 0 (no status bar).

Parameters:
width - the horizontal pixel size of the game grid window
height - the vertical pixel size of the game grid window
bgColor - the background color of the game grid window

CardGame

public CardGame(int width,
                int height,
                java.awt.Color bgColor,
                int statusHeight,
                int simulationPeriod)
Constructs and shows a game grid window with the given horizontal and vertical pixel size (cell size = 1, no navigation bar). Sets the background color, the simulation period and and adds a status bar of given statusHeight (if statusHeight > 0).
GameGrid.doRun() is called to start the simulation cycling.

Parameters:
width - the horizontal pixel size of the game grid window
height - the vertical pixel size of the game grid window
bgColor - the background color of the game grid window
statusHeight - the height of the status bar in pixels; if less or equal zero, no status bar is displayed
simulationPeriod - the simulation period used for the simulation cycling