simpleGamePlatform
Class GamePlatform

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by simpleGamePlatform.BufferedApplet
                      extended by simpleGamePlatform.GamePlatform
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, javax.accessibility.Accessible

public class GamePlatform
extends simpleGamePlatform.BufferedApplet

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class simpleGamePlatform.BufferedApplet
animating, damage
 
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
GamePlatform()
           
 
Method Summary
 Piece addPiece()
          Allocate a new piece and add it to the scene.
 Piece addPiece(Piece piece)
          Add an already existing piece to the scene.
 Piece addPiece(java.lang.String className)
          Allocate a new piece of the given object class, and add it to the scene.
 void endCollision(Piece one, Piece two)
          Callback function, invoked at the end of a collision between two pieces.
 int getHeight()
          Returns the height of the game window.
 int getWidth()
          Returns the width of the game window.
 boolean keyDown(java.awt.Event e, int key)
          Called by the system when the user presses a key on the keyboard.
 boolean keyUp(java.awt.Event e, int key)
          Called by the system when the user releases a key on the keyboard.
 boolean mouseDown(java.awt.Event e, int x, int y)
          Called by the system when the user presses the mouse.
 boolean mouseDrag(java.awt.Event e, int x, int y)
          Called by the system when the user drags the mouse.
 boolean mouseMove(java.awt.Event e, int x, int y)
          Called by the system when the user moves the mouse.
 boolean mouseUp(java.awt.Event e, int x, int y)
          Called by the system when the user releases the mouse.
 void overlay(java.awt.Graphics g)
          Subclasses can override this method to draw graphics over the scene.
 Piece piece(int i)
          Returns a piece in this game, indexed by its order of creation.
 javax.sound.sampled.Clip playClip(java.lang.String fileName)
          Play an audio clip, given the name of the file containing the audio clip.
 void render(java.awt.Graphics g)
          Called by the system -- the rendering loop.
 Piece selectedPiece()
          Returns which piece is currently selected.
 void setCollisionTracked(Piece piece)
          Indicate that collisions for this piece should be tracked.
 void setLogging(boolean state)
          Toggle whether there will be data logging.
 void setProjectName(java.lang.String name)
          For data logging purposes, set a name for this project.
 void setup()
          Subclasses can override this method to set up the game board.
 void setVerbosity(int level)
          Set the level of verbosity of reporting game events.
 void startCollision(Piece one, Piece two)
          Callback function, invoked at the start of a collision between two pieces.
 int stringWidth(java.awt.Graphics g, java.lang.String s)
          Return the width, in pixels, of a text string.
 void track(java.lang.Object object, java.lang.String name)
          Track the values of an object, for logging purposes.
 void track(java.lang.Object object, java.lang.String name, java.lang.String varNames)
          Track specific variables of an object, for logging purposes.
 void update()
          Subclasses can override this method to define a 30fps update behavior.
 
Methods inherited from class simpleGamePlatform.BufferedApplet
paint, run, start, stop, update
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, list, list, list, location, lostFocus, mouseEnter, mouseExit, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GamePlatform

public GamePlatform()
Method Detail

setProjectName

public void setProjectName(java.lang.String name)
For data logging purposes, set a name for this project.


setLogging

public void setLogging(boolean state)
Toggle whether there will be data logging.


selectedPiece

public Piece selectedPiece()
Returns which piece is currently selected.


startCollision

public void startCollision(Piece one,
                           Piece two)
Callback function, invoked at the start of a collision between two pieces.


endCollision

public void endCollision(Piece one,
                         Piece two)
Callback function, invoked at the end of a collision between two pieces.


setVerbosity

public void setVerbosity(int level)
Set the level of verbosity of reporting game events.


piece

public Piece piece(int i)
Returns a piece in this game, indexed by its order of creation.


getWidth

public int getWidth()
Returns the width of the game window.

Overrides:
getWidth in class java.awt.Component

getHeight

public int getHeight()
Returns the height of the game window.

Overrides:
getHeight in class java.awt.Component

setCollisionTracked

public void setCollisionTracked(Piece piece)
Indicate that collisions for this piece should be tracked.


mouseMove

public boolean mouseMove(java.awt.Event e,
                         int x,
                         int y)
Called by the system when the user moves the mouse.

Overrides:
mouseMove in class java.awt.Component

mouseDown

public boolean mouseDown(java.awt.Event e,
                         int x,
                         int y)
Called by the system when the user presses the mouse.

Overrides:
mouseDown in class java.awt.Component

mouseDrag

public boolean mouseDrag(java.awt.Event e,
                         int x,
                         int y)
Called by the system when the user drags the mouse.

Overrides:
mouseDrag in class java.awt.Component

mouseUp

public boolean mouseUp(java.awt.Event e,
                       int x,
                       int y)
Called by the system when the user releases the mouse.

Overrides:
mouseUp in class java.awt.Component

keyDown

public boolean keyDown(java.awt.Event e,
                       int key)
Called by the system when the user presses a key on the keyboard.

Overrides:
keyDown in class java.awt.Component

keyUp

public boolean keyUp(java.awt.Event e,
                     int key)
Called by the system when the user releases a key on the keyboard.

Overrides:
keyUp in class java.awt.Component

setup

public void setup()
Subclasses can override this method to set up the game board.


update

public void update()
Subclasses can override this method to define a 30fps update behavior.


overlay

public void overlay(java.awt.Graphics g)
Subclasses can override this method to draw graphics over the scene.


render

public void render(java.awt.Graphics g)
Called by the system -- the rendering loop.

Specified by:
render in class simpleGamePlatform.BufferedApplet

addPiece

public Piece addPiece()
Allocate a new piece and add it to the scene.


addPiece

public Piece addPiece(java.lang.String className)
Allocate a new piece of the given object class, and add it to the scene.


addPiece

public Piece addPiece(Piece piece)
Add an already existing piece to the scene.


playClip

public javax.sound.sampled.Clip playClip(java.lang.String fileName)
Play an audio clip, given the name of the file containing the audio clip.


stringWidth

public int stringWidth(java.awt.Graphics g,
                       java.lang.String s)
Return the width, in pixels, of a text string.


track

public void track(java.lang.Object object,
                  java.lang.String name)
Track the values of an object, for logging purposes.


track

public void track(java.lang.Object object,
                  java.lang.String name,
                  java.lang.String varNames)
Track specific variables of an object, for logging purposes.