|
||||||||
| 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
fang.GameWindow
fang.FrameAdvancer
fang.GameLoop
fang.GameRedirection
public abstract class GameRedirection
This class redirects all method calls to the originally extended JApplet.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JApplet |
|---|
JApplet.AccessibleJApplet |
| Nested classes/interfaces inherited from class java.applet.Applet |
|---|
Applet.AccessibleApplet |
| Nested classes/interfaces inherited from class java.awt.Panel |
|---|
Panel.AccessibleAWTPanel |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected boolean |
finishingGame
|
protected Game |
firstGame
|
protected boolean |
restarting
|
| Fields inherited from class fang.GameLoop |
|---|
client, player, random, SEED |
| Fields inherited from class fang.FrameAdvancer |
|---|
canvas, timeInterval |
| Fields inherited from class fang.GameWindow |
|---|
cards, connectButton, container, createOwnFrame, displayControlButtons, frame, fullScreen, help, helpPlay, loadingMessage, mute, pause, players, playersSelectable, playersSpinner, quit, serverField, serverLabel, serverSelectable, sessionComboBox, sessionLabel, sessionSelectable, 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 | |
|---|---|
GameRedirection(Dimension gameDimensions,
Color backgroundColor)
Constructs a game level; permits creation of a container of game levels and linking of the finish of one game to the beginning of another game/level. |
|
| Method Summary | |
|---|---|
void |
addGame(Game game)
Add a game to the list of games waiting to be played. |
void |
addLevel(GameLevel level)
Deprecated. |
abstract void |
advance()
|
void |
advance(double secondsElapsed)
|
void |
advanceFrame(double secondsElapsed)
Deprecated. |
void |
advanceLevel()
Deprecated. |
void |
begin()
starts session by connecting to the server |
void |
cancel(TimedAction action)
|
void |
cancelAlarm(Alarm alarm)
removes all pending alarms on this object. |
void |
cancelAllAlarms()
removes all pending alarms. |
void |
cancelAllTimedActions()
|
void |
cleanUp()
this method will be called by the FANG Engine just before terminating the level in case the level needs an opportunity to perform some final operations |
void |
connect(String server,
String gameName,
String sessionName,
int players)
connects to the server and sets the game and session name and sets the number of players |
protected void |
copyFirstFields()
|
protected void |
copyFrom(Game game)
|
void |
disconnect()
disconnects from server. |
void |
finishGame()
Finish the game. |
void |
finishLevel()
Deprecated. |
boolean |
gameIsOver()
determines if the game is over. |
Alarm[] |
getAlarms()
gets the list of alarms scheduled to go off in the future. |
TimedAction[] |
getAllTimedActions()
|
AnimationCanvas |
getCanvas()
returns the canvas |
static Game |
getCurrentGame()
Get a reference to the current game without having to know anything about the type of the game. |
String |
getGameName()
gets the name of this game which by default is the name of the class |
int |
getID()
gets the index of the current player. |
int |
getLevelNumber()
Deprecated. |
GameLevel |
getNextLevel()
Deprecated. |
int |
getNumberOfPlayers()
gets the number of connected players in this game. |
Player |
getPlayer()
gets the current player object. |
Player |
getPlayer(int playerIndex)
gets the player object for a given player number. |
Player |
getPlayer(String name)
gets the player object for a given player name. |
double |
getScreenRefreshRate()
returns the screen refresh rate |
String |
getServerName()
gets the name of the server. |
String |
getSessionName()
gets the name of the session. |
double |
getTime()
returns the current time in seconds since the beginning of this game. |
void |
initializePersistantState(Alarm[] alarms,
Sprite[] sprites,
Sound[] sounds)
copies all of the peristent alarms, sprites, and sounds into this level's persistence collections |
boolean |
isGameOver()
|
boolean |
isMuted()
returns true if muted, false if not muted |
boolean |
isPaused()
returns true if paused, false if the game is running |
void |
muteSound()
turns the sound off |
void |
pause()
temporarily stops the game from running |
protected void |
pauseToggle()
changes between paused and unpaused |
void |
persist(Alarm alarm)
adds an alarm to the collection of alarms which will persist after the level ends. |
void |
persist(Sound sound)
adds a sound to the collection of sounds which will persist after the level ends. |
void |
persist(Sprite sprite)
adds a sprite to the collection of sprites which will persist after the level ends. |
void |
playSound()
turns sound on |
void |
playSoundImmediately()
makes the game sound audible |
protected void |
reallyFinishGame()
|
protected void |
reallyStartOver()
|
void |
refreshScreen()
updates the AnimationCanvas, should only be called from the AWTEvent Thread. |
void |
removeCursor()
removes the cursor from the game canvas |
protected void |
removeLevelObjects()
removes all the non-persistent sprites, alarms, and sounds |
void |
resetTime()
makes the current time zero |
void |
restoreCursor()
adds the default cursor back to the screen |
void |
resume()
makes the game time start running after being paused |
void |
runAsApplication()
runs as an application. |
void |
schedule(TimedAction action,
double delay)
|
void |
scheduleAbsolute(Alarm alarm,
double absolute)
sets and alarm to go off at a time relative to the beginning of time (zero). |
void |
scheduleRelative(Alarm alarm,
double relative)
sets and alarm to go off relative to the current time. |
void |
sendMessage(Object localMessage)
sends a message to all of the clients |
void |
serverSaysPauseToggle()
changes the display between pause/resume when a pause message is sent from the server. |
void |
setCanvas(AnimationCanvas canvas)
set canvas to a new canvas |
void |
setCursor(URL url)
sets the cursor for the game engine |
void |
setGameName(String gameName)
sets the name of the game. |
void |
setGameOver(boolean gameOver)
sets the game state to gameOver. |
void |
setHelp(String filename)
this method must be called in order to set the help screen. |
void |
setHelpText(String helpText)
|
void |
setMinimumModelFrameRate(int framesPerSecond)
sets the minimum number of frames which must be computed per second. |
void |
setNextLevel(GameLevel level)
Deprecated. |
void |
setNumberOfPlayers(int numPlayers)
sets the number of players. |
void |
setServerName(String server)
sets the name of the server. |
void |
setSessionName(String sessionName)
sets the name of the session. |
void |
setTitle(String topTitle)
Sets the title at the top of the JFrame and/or applet |
abstract void |
setup()
|
void |
startGame()
starts game. |
void |
startGameImmediately()
makes the game start immediately when loaded |
void |
startOver()
starts the game over. |
void |
stop()
disconnects from the server and stops the advancing of frames. |
protected void |
toggleAudible()
Deprecated. use of this method is depricated; use toggleSound instead |
void |
togglePause()
|
void |
toggleSound()
switches between mute and audible |
void |
updateModel(double time)
updates the model between displays. |
| Methods inherited from class fang.GameLoop |
|---|
getGameOverLevel, getGameResource, getResource, main, postAdvanceFrame |
| Methods inherited from class fang.FrameAdvancer |
|---|
setBackground |
| Methods inherited from class fang.GameWindow |
|---|
actionPerformed, getDefaultSize, getHash, getHelpStyleSheet, getHostname, init, isCreatingOwnFrame, setCreateOwnFrame, setDefaultHelp, setLoadMessage, 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, start |
| Methods inherited from class java.awt.Panel |
|---|
addNotify |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Game firstGame
protected boolean finishingGame
protected boolean restarting
| Constructor Detail |
|---|
public GameRedirection(Dimension gameDimensions,
Color backgroundColor)
gameDimensions - the dimensions, in pixels, of the game canvas part of the game window. The play area size.backgroundColor - color to wipe the backtground to| Method Detail |
|---|
protected void copyFirstFields()
public static Game getCurrentGame()
public void addGame(Game game)
game - the Game to add to the end of the list of upcoming gamespublic void finishGame()
protected void reallyFinishGame()
public final void addLevel(GameLevel level)
fang.core.addGame
instead.
addLevel in class GameLooplevel - the game level to add to the list of levels to execute in orderpublic final void finishLevel()
fang.core.finishGame instead.
finishLevel in class GameLooppublic final GameLevel getNextLevel()
getNextLevel in class GameLooppublic final void advanceLevel()
GameLoop
advanceLevel in class GameLooppublic final int getLevelNumber()
GameLoop
getLevelNumber in class GameLooppublic final void setNextLevel(GameLevel level)
GameLoop
setNextLevel in class GameLooplevel - the game level to insert into the list of levels to executepublic final void advanceFrame(double secondsElapsed)
GameLoop
advanceFrame in class GameLoopsecondsElapsed - the duration of time which has passed since the last frame was
calculated or displayed.public void advance(double secondsElapsed)
public abstract void advance()
protected void removeLevelObjects()
public void startOver()
startOver in class GameLoopprotected void reallyStartOver()
public void cleanUp()
public void persist(Alarm alarm)
alarm - the alarm to keep after the level terminatespublic void persist(Sprite sprite)
sprite - the sprite to keep after the level terminatespublic void persist(Sound sound)
sound - the sound to keep after the level terminates
public void initializePersistantState(Alarm[] alarms,
Sprite[] sprites,
Sound[] sounds)
alarms - the alarms which came from the last levelsprites - the sprites which came from the last levelsounds - the sounds which came from the last lelelpublic abstract void setup()
public final void startGame()
GameLoop
startGame in class GameLoopprotected void copyFrom(Game game)
public final void toggleSound()
GameLoop
toggleSound in class GameLoop@Deprecated protected final void toggleAudible()
toggleAudible in class GameLooppublic boolean isMuted()
GameLoop
isMuted in class GameLooppublic void muteSound()
GameLoop
muteSound in class GameLooppublic void playSound()
GameLoop
playSound in class GameLooppublic void pause()
GameLoop
pause in class GameLooppublic void resume()
GameLoop
resume in class GameLooppublic void startGameImmediately()
GameLoop
startGameImmediately in class GameLooppublic void playSoundImmediately()
GameLoop
playSoundImmediately in class GameLooppublic void begin()
GameLoop
begin in class GameLooppublic final void setServerName(String server)
GameLoop
setServerName in class GameLoopserver - the domain name of the gaming server to which this game will
connectpublic final void setSessionName(String sessionName)
GameLoop
setSessionName in class GameLoopsessionName - the name of the session used to connect with other playerspublic String getSessionName()
GameLoop
getSessionName in class GameLooppublic String getServerName()
GameLoop
getServerName in class GameLooppublic final void setGameName(String gameName)
GameLoop
setGameName in class GameLoopgameName - the name of this gamepublic String getGameName()
GameLoop
getGameName in class GameLooppublic final void setNumberOfPlayers(int numPlayers)
GameLoop
setNumberOfPlayers in class GameLoopnumPlayers - the number of players to wait for before starting the game.public int getNumberOfPlayers()
GameLoop
getNumberOfPlayers in class GameLooppublic void sendMessage(Object localMessage)
GameLoop
sendMessage in class GameLooplocalMessage - a Serializable message which is sent to all clients
public final void connect(String server,
String gameName,
String sessionName,
int players)
GameLoop
connect in class GameLoopserver - the name of the domain which hosts the gaming servergameName - the name of this game which is used for determining which players
to connect tosessionName - the name of this particular session of the game. Both the game
name and session name must match when connecting to a group of
players.players - how many players to wait for before connectingpublic final void stop()
GameLoop
stop in class GameLooppublic final void disconnect()
GameLoop
disconnect in class GameLooppublic boolean isPaused()
GameLoop
isPaused in class GameLooppublic final void togglePause()
togglePause in class GameLoopprotected final void pauseToggle()
GameLoop
pauseToggle in class GameLooppublic final void serverSaysPauseToggle()
GameLoop
serverSaysPauseToggle in class GameLooppublic int getID()
GameLoop
getID in class GameLooppublic Player getPlayer(int playerIndex)
GameLoop
getPlayer in class GameLoopplayerIndex - the player number. See getNumberOfPlayers to determine how many
players are connected to this game.
public Player getPlayer(String name)
GameLoop
getPlayer in class GameLoopname - String name associated with the Player
public final boolean gameIsOver()
GameLoop
gameIsOver in class GameLooppublic boolean isGameOver()
public void setGameOver(boolean gameOver)
GameLoop
setGameOver in class GameLoopgameOver - true indicating the game over status should be set to game over,
false does nothingpublic Player getPlayer()
GameLoop
getPlayer in class GameLooppublic void setCanvas(AnimationCanvas canvas)
FrameAdvancer
setCanvas in class FrameAdvancerpublic AnimationCanvas getCanvas()
FrameAdvancer
getCanvas in class FrameAdvancerpublic double getTime()
FrameAdvancer
getTime in class FrameAdvancerpublic double getScreenRefreshRate()
FrameAdvancer
getScreenRefreshRate in class FrameAdvancerpublic void setMinimumModelFrameRate(int framesPerSecond)
FrameAdvancer
setMinimumModelFrameRate in class FrameAdvancerframesPerSecond - the number of frames computed per second
public final void scheduleRelative(Alarm alarm,
double relative)
FrameAdvancer
scheduleRelative in interface AlarmSchedulerscheduleRelative in class FrameAdvanceralarm - the class to call the alarm method onrelative - the time from now in seconds to call the alarm method
public final void scheduleAbsolute(Alarm alarm,
double absolute)
FrameAdvancer
scheduleAbsolute in interface AlarmSchedulerscheduleAbsolute in class FrameAdvanceralarm - the class to call the alarm method onabsolute - the time in seconds to call the alarm methodpublic final void cancelAlarm(Alarm alarm)
FrameAdvancer
cancelAlarm in interface AlarmSchedulercancelAlarm in class FrameAdvanceralarm - the object that is the target of a pending alarmpublic final void cancelAllAlarms()
FrameAdvancer
cancelAllAlarms in interface AlarmSchedulercancelAllAlarms in class FrameAdvancerpublic final Alarm[] getAlarms()
FrameAdvancer
getAlarms in class FrameAdvancer
public void schedule(TimedAction action,
double delay)
schedule in class FrameAdvancerpublic void cancel(TimedAction action)
cancel in class FrameAdvancerpublic void cancelAllTimedActions()
cancelAllTimedActions in class FrameAdvancerpublic TimedAction[] getAllTimedActions()
getAllTimedActions in class FrameAdvancerpublic void updateModel(double time)
FrameAdvancer
updateModel in class FrameAdvancertime - the current absolute timepublic void setCursor(URL url)
FrameAdvancer
setCursor in class FrameAdvancerpublic void removeCursor()
FrameAdvancer
removeCursor in class FrameAdvancerpublic void restoreCursor()
FrameAdvancer
restoreCursor in class FrameAdvancerpublic final void refreshScreen()
FrameAdvancer
refreshScreen in class FrameAdvancerpublic void resetTime()
FrameAdvancer
resetTime in class FrameAdvancerpublic void runAsApplication()
GameWindow
runAsApplication in class GameWindowpublic void setTitle(String topTitle)
GameWindow
setTitle in class GameWindowtopTitle - the text for the titlepublic void setHelp(String filename)
GameWindow
setHelp in class GameWindowfilename - the relative file name
of the help html filepublic void setHelpText(String helpText)
setHelpText in class GameWindow
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||