|
||||||||
| 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
public abstract class FrameAdvancer
used to advance the frame in an animation using the AnimationCanvas. There are two basic parametes to the FrameAdvancer: the model frame rate and the screen frame rate. The model frame rate describes the number of frames per second which must be computed to have a consistent model. This in effect determines the maximum time for computations between displays. The screen frame rate is how often the screen is refreshed with the current Sprites. The screen rate is never higher than the model rate.
| 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 AnimationCanvas |
canvas
the canvas which displays the Sprites |
double |
timeInterval
time since the last call to updateInterval |
| 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 | |
|---|---|
FrameAdvancer()
initializes the canvas to empty and no alarms set |
|
FrameAdvancer(Dimension gameDimensions)
initializes the canvas to size and no alarms set |
|
FrameAdvancer(Dimension gameDimensions,
Color backgroundColor)
|
|
| Method Summary | |
|---|---|
void |
advanceFrame(double timePassed)
called repeatedly between every model update |
void |
cancel(TimedAction action)
|
void |
cancelAlarm(Alarm alarm)
removes all pending alarms on this object. |
void |
cancelAllAlarms()
removes all pending alarms. |
void |
cancelAllTimedActions()
|
Alarm[] |
getAlarms()
gets the list of alarms scheduled to go off in the future. |
TimedAction[] |
getAllTimedActions()
|
AnimationCanvas |
getCanvas()
returns the canvas |
double |
getScreenRefreshRate()
returns the screen refresh rate |
double |
getTime()
returns the current time in seconds since the beginning of this game. |
abstract void |
postAdvanceFrame(double timePassed)
called after advanceFrame |
void |
refreshScreen()
updates the AnimationCanvas, should only be called from the AWTEvent Thread. |
void |
removeCursor()
removes the cursor from the game canvas |
void |
resetTime()
makes the current time zero |
void |
restoreCursor()
adds the default cursor back to the screen |
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 |
setBackground(Color backgroundColor)
Set the bacground color of this game. |
void |
setCanvas(AnimationCanvas canvas)
set canvas to a new canvas |
void |
setCursor(URL url)
sets the cursor for the game engine |
void |
setMinimumModelFrameRate(int framesPerSecond)
sets the minimum number of frames which must be computed per second. |
void |
updateModel(double time)
updates the model between displays. |
| Methods inherited from class fang.GameWindow |
|---|
actionPerformed, begin, disconnect, getDefaultSize, getGameName, getHash, getHelpStyleSheet, getHostname, getServerName, getSessionName, init, isCreatingOwnFrame, pauseToggle, runAsApplication, setCreateOwnFrame, setDefaultHelp, setGameName, setHelp, setHelpText, setLoadMessage, setNumberOfPlayers, setServerName, setSessionName, setTitle, startGame, stop, toggleAudible, 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 AnimationCanvas canvas
public double timeInterval
| Constructor Detail |
|---|
public FrameAdvancer()
public FrameAdvancer(Dimension gameDimensions)
public FrameAdvancer(Dimension gameDimensions,
Color backgroundColor)
| Method Detail |
|---|
public void setBackground(Color backgroundColor)
setBackground in class ComponentbackgroundColor - color to use for the background of the game fieldpublic void setCanvas(AnimationCanvas canvas)
canvas - public AnimationCanvas getCanvas()
getCanvas in class GameWindowpublic void advanceFrame(double timePassed)
public double getTime()
public double getScreenRefreshRate()
public void setMinimumModelFrameRate(int framesPerSecond)
framesPerSecond - the number of frames computed per second
public void scheduleRelative(Alarm alarm,
double relative)
scheduleRelative in interface AlarmScheduleralarm - the class to call the alarm method onrelative - the time from now in seconds to call the alarm method
public void schedule(TimedAction action,
double delay)
public void scheduleAbsolute(Alarm alarm,
double absolute)
scheduleAbsolute in interface AlarmScheduleralarm - the class to call the alarm method onabsolute - the time in seconds to call the alarm methodpublic void cancelAlarm(Alarm alarm)
cancelAlarm in interface AlarmScheduleralarm - the object that is the target of a pending alarmpublic void cancel(TimedAction action)
public void cancelAllAlarms()
cancelAllAlarms in interface AlarmSchedulerpublic void cancelAllTimedActions()
public TimedAction[] getAllTimedActions()
public Alarm[] getAlarms()
public void updateModel(double time)
time - the current absolute timepublic void setCursor(URL url)
filename - the image to display as the cursorpublic void removeCursor()
public void restoreCursor()
public abstract void postAdvanceFrame(double timePassed)
timePassed - the duration since the last framepublic void refreshScreen()
public void resetTime()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||