|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--MarbleGameCanvas
MarbleGameCanvas is the canvas object which all the drawings and animations of the marble game takes place. Double-buffering is handled by the DoubleBufferHandler. Based on the PoolTable class implemented by Steve Revilak.
Inner classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
ShooterMarble |
player0Marble
The player 1's shooter. |
ShooterMarble |
player1Marble
The player 2's shooter. |
Fields inherited from class java.awt.Component |
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
MarbleGameCanvas()
|
Method Summary | |
boolean |
changeTurn()
Check if a player's turn has been changed. |
void |
clearMarks()
Clear the marks on this canvas. |
int |
getBorderWidth()
Get the width of the border. |
void |
initCanvas(Player p0,
Player p1, java.awt.Image image)
Initialize this canvas. |
boolean |
isGameOver()
Check if the game is over. |
void |
paint(java.awt.Graphics g)
Draw objects on the given Graphics. |
void |
paintFrame(java.awt.Graphics g)
Update drawing/animation frame on the given Graphics object. |
void |
resetCanvas()
Reset this canvas to the game start state. |
void |
resetLagCanvas()
Reset this canvas to the Lagging session state. |
void |
setChangeTurn(boolean flag)
Set the changeTurn flag. |
int |
setMark(int x,
int y) Ask this canvas to set a marker at the given coordinates. |
void |
shootMarble(int playerID)
Shoot the marble. |
int |
shootShooterMarble(int playerID)
For handling lag shots |
void |
update(java.awt.Graphics g)
Update the drawing of the objects on the given Graphics for double-buffering. |
Methods inherited from class java.awt.Canvas |
|
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface DoubleBufferedComponent |
createImage,
getSize |
Field Detail |
public ShooterMarble player0Marble
public ShooterMarble player1Marble
Constructor Detail |
public MarbleGameCanvas()
Method Detail |
public void initCanvas(Player p0, Player p1, java.awt.Image image)
p0
- the Player (player 1) for the gamep1
- the Player (player 2) for the gameimage
- the image to be drawn (in this case, the ring image)public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
g
- the Graphics objectpublic void update(java.awt.Graphics g)
update
in class java.awt.Component
g
- the Graphics objectpublic void paintFrame(java.awt.Graphics g)
paintFrame
in interface DoubleBufferedComponent
g
- the Graphics object.public int getBorderWidth()
public void setChangeTurn(boolean flag)
flag
- the changeTurn flag to set topublic boolean changeTurn()
public boolean isGameOver()
public void resetCanvas()
public void resetLagCanvas()
public int setMark(int x, int y)
x
- the x coordinate of the marky
- the y coordinate of the markpublic void clearMarks()
public void shootMarble(int playerID)
playerID
- the ID of the Player.public int shootShooterMarble(int playerID)
playerID
- the ID of the Player
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |