|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
javax.swing.JApplet
tipgame.GameWindow
tipgame.FrameAdvancer
tipgame.GameLoop
public abstract class GameLoop
adds a mouse and keyboard interaction to FrameAdvancer
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JApplet |
|---|
javax.swing.JApplet.AccessibleJApplet |
| 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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private boolean |
audible
field which can be used to mute/enable sound |
private Client |
client
used to stream keyboard/mouse information to/from the server/client |
private java.lang.String |
gameName
name of game |
private int |
id
which index belongs to this computer |
protected java.lang.Object[] |
messages
messages |
private int |
numPlayers
number of payers |
protected Keyboard[] |
playerKeyboard
all keyboards |
protected Mouse[] |
playerMouse
all mouses |
static java.util.Random |
random
used for random numbers |
static long |
SEED
seed for random numbers |
private java.lang.String |
server
server name |
private java.lang.String |
sessionName
name of session |
| Fields inherited from class tipgame.FrameAdvancer |
|---|
canvas, timeInterval |
| Fields inherited from class tipgame.GameWindow |
|---|
frame, gameLoop, hasFrame, help, helpPlay, mute, pause, quit, title |
| Fields inherited from class javax.swing.JApplet |
|---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
| 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 | |
|---|---|
GameLoop()
constructs a GameLoop with the default size AnimationCanvas (given in FrameAdvancer) |
|
GameLoop(java.awt.Dimension size)
constructs a GameLoop with the given size |
|
| Method Summary | |
|---|---|
void |
connect(java.lang.String server,
java.lang.String gameName,
java.lang.String sessionName,
int players)
connects to the server and sets the game and session name and sets the number of players |
void |
disconnect()
disconnects from server |
int |
getID()
|
boolean |
isMuted()
returns true if muted, false if not muted |
boolean |
isPaused()
returns true if paused |
void |
pauseToggle()
changes between paused and unpaused |
void |
postAdvanceFrame()
clears the keyboard and mouse stuff |
void |
sendMessage(java.lang.Object localMessage)
sends message |
void |
setGameName(java.lang.String gameName)
sets the name of the game |
void |
setNumberOfPlayers(int numPlayers)
sets the number of players |
void |
setServerName(java.lang.String server)
sets the name of the server |
void |
setSessionName(java.lang.String sessionName)
sets the name of the session |
void |
start()
starts session |
void |
startGame()
starts game |
void |
toggleAudible()
switches between mute and audible |
| Methods inherited from class tipgame.FrameAdvancer |
|---|
advanceFrame, cancelAlarm, clearAllAlarms, getCanvas, getScreenRefreshRate, getTime, refreshScreen, scheduleAbsolute, scheduleRelative, setCanvas, setMinimumModelFrameRate, updateModel |
| Methods inherited from class tipgame.GameWindow |
|---|
actionPerformed, getDefaultSize, getHelpURL, init, runAsApplication, setTitle, setUseFrame, stop, windowStateChanged |
| Methods inherited from class javax.swing.JApplet |
|---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.applet.Applet |
|---|
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, 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, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, 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, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, 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 |
| Field Detail |
|---|
public static final long SEED
public static java.util.Random random
private Client client
protected Keyboard[] playerKeyboard
protected Mouse[] playerMouse
private int id
protected java.lang.Object[] messages
private java.lang.String server
private java.lang.String gameName
private java.lang.String sessionName
private int numPlayers
private boolean audible
| Constructor Detail |
|---|
public GameLoop()
public GameLoop(java.awt.Dimension size)
size - the size of the AnimationCanvas| Method Detail |
|---|
public void toggleAudible()
toggleAudible in class GameWindowpublic boolean isMuted()
public void start()
start in class java.applet.Appletpublic void startGame()
startGame in class GameWindowpublic void postAdvanceFrame()
postAdvanceFrame in class FrameAdvancerpublic void setServerName(java.lang.String server)
setServerName in class GameWindowserver - public void setSessionName(java.lang.String sessionName)
setSessionName in class GameWindowsessionName - public void setGameName(java.lang.String gameName)
setGameName in class GameWindowgameName - public void setNumberOfPlayers(int numPlayers)
setNumberOfPlayers in class GameWindownumPlayers - public void sendMessage(java.lang.Object localMessage)
localMessage -
public void connect(java.lang.String server,
java.lang.String gameName,
java.lang.String sessionName,
int players)
server - gameName - sessionName - players - public void disconnect()
disconnect in class GameWindowpublic boolean isPaused()
public void pauseToggle()
pauseToggle in class GameWindowpublic int getID()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||