|
||||||||||
| 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.Window
java.awt.Frame
javax.swing.JFrame
frog.demo.DemoGame
public class DemoGame
The main class for the Demo mode of FROG. DemoGame features a four-player
game in which cows are abducted by UFOs and it is up to the players to save
the cows from their otherworldly fate. Players perform the gestures that
appear on the UFOs coming for the cows. Successfully performed gestures will
destroy a UFO of that type, awarding points to the killing player, and
buying a little more time before the next UFO swoops in.
DemoGame is responsible for setting up all the internals of the game such as
the sounds and images that will be used. After starting the DemoController
which manages input and output, the DemoGame will continue to maintain a
stable FPS until the game has been exited by pressing the ESC key.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JFrame |
|---|
JFrame.AccessibleJFrame |
| Nested classes/interfaces inherited from class java.awt.Frame |
|---|
Frame.AccessibleAWTFrame |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
Clip[] |
ABDUCT_SOUND
Sounds |
(package private) static int |
ABDUCT_VARIANCE
How many of that sound file there is |
BufferedImage |
BG_IMG
Image for the game |
Clip[] |
BOOSH_SOUND
Sounds |
(package private) static int |
BOOSH_VARIANCE
How many of that sound file there is |
DemoController |
controller
The controller for this DemoGame. |
static float |
COW_HEIGHT
Proportional dimension of the CowSprite |
BufferedImage[] |
COW_IMG
Animated image for the game |
static float |
COW_WIDTH
Proportional dimension of the CowSprite |
(package private) static int |
DELAYS_PER_YIELD
|
(package private) static long |
DESIRED_FPS
|
Clip[] |
EXPLOSION_SOUND
Sounds |
(package private) static int |
EXPLOSION_VARIANCE
How many of that sound file there is |
JFrame |
frame
The fullscreen frame that will be displaying this game |
BufferedImage |
GAMEOVER_IMG
Image for the game |
int |
height
The 4:3 aspect ratio dimension for the user's monitor |
(package private) static int |
MAX_FRAME_SKIPS
Maximum allowed frame skips before updates begin to slow down |
Clip[] |
MOO_SOUND
Sounds |
(package private) static int |
MOO_VARIANCE
How many of that sound file there is |
(package private) static int |
NUM_BUFFERS
Number of buffers for page flipping |
int |
offset
The 4:3 aspect ratio dimension for the user's monitor |
(package private) static long |
PERIOD
|
Vector<Player> |
players
Players for this game are stored here |
int |
SCREEN_HEIGHT
The fullscreen dimension for the user's monitor |
int |
SCREEN_WIDTH
The fullscreen dimension for the user's monitor |
BufferedImage[] |
UFO_C_IMG
Animated image for the game |
static float |
UFO_HEIGHT
Proportional dimension of the UFOSprite |
BufferedImage[] |
UFO_S_IMG
Animated image for the game |
BufferedImage[] |
UFO_T_IMG
Animated image for the game |
static float |
UFO_WIDTH
Proportional dimension of the UFOSprite |
BufferedImage[] |
UFO_X_IMG
Animated image for the game |
BufferedImage[] |
UFO_Z_IMG
Animated image for the game |
int |
width
The 4:3 aspect ratio dimension for the user's monitor |
Clip[] |
WOOSH_SOUND
Sounds |
(package private) static int |
WOOSH_VARIANCE
How many of that sound file there is |
| Fields inherited from class javax.swing.JFrame |
|---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Frame |
|---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DemoGame(Collection<User> players)
Starts a new DemoGame with the given Players. |
|
| Method Summary | |
|---|---|
void |
keyPressed(KeyEvent e)
|
void |
keyReleased(KeyEvent e)
|
void |
keyTyped(KeyEvent e)
|
void |
run()
Sleep timing and draw/update calls based heavily on an example from the book "Killer Game Programming" by Andrew Davison. |
void |
stopGame()
Signal game over. |
| Methods inherited from class java.awt.Frame |
|---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
|---|
getFont, postEvent |
| Field Detail |
|---|
public final DemoController controller
public final int width
public final int height
public final int offset
public final int SCREEN_WIDTH
public final int SCREEN_HEIGHT
public final JFrame frame
public final BufferedImage BG_IMG
public final BufferedImage GAMEOVER_IMG
public final BufferedImage[] COW_IMG
public final BufferedImage[] UFO_C_IMG
public final BufferedImage[] UFO_S_IMG
public final BufferedImage[] UFO_T_IMG
public final BufferedImage[] UFO_X_IMG
public final BufferedImage[] UFO_Z_IMG
public final Clip[] MOO_SOUND
public final Clip[] EXPLOSION_SOUND
public final Clip[] ABDUCT_SOUND
public final Clip[] WOOSH_SOUND
public final Clip[] BOOSH_SOUND
static final int MOO_VARIANCE
static final int EXPLOSION_VARIANCE
static final int ABDUCT_VARIANCE
static final int WOOSH_VARIANCE
static final int BOOSH_VARIANCE
public final Vector<Player> players
static final int NUM_BUFFERS
static final int MAX_FRAME_SKIPS
static final int DELAYS_PER_YIELD
static final long DESIRED_FPS
static final long PERIOD
public static final float UFO_WIDTH
public static final float UFO_HEIGHT
public static final float COW_WIDTH
public static final float COW_HEIGHT
| Constructor Detail |
|---|
public DemoGame(Collection<User> players)
throws Exception
players - the Players for this game.
Exception - if full screen mode is not supported.| Method Detail |
|---|
public void run()
run in interface Runnablepublic void stopGame()
public void keyPressed(KeyEvent e)
keyPressed in interface KeyListenerpublic void keyReleased(KeyEvent e)
keyReleased in interface KeyListenerpublic void keyTyped(KeyEvent e)
keyTyped in interface KeyListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||