DemoGame Class Reference
The main class for the Demo mode of FROG. More...
Inherits javax::swing::JFrame.
Public Member Functions | |
DemoGame (Collection< User > players) throws Exception | |
Starts a new DemoGame with the given Players. | |
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. | |
void | keyPressed (KeyEvent e) |
void | keyReleased (KeyEvent e) |
void | keyTyped (KeyEvent e) |
Public Attributes | |
final DemoController | controller |
The controller for this DemoGame. | |
final int | width |
The 4:3 aspect ratio dimension for the user's monitor. | |
final int | height |
final int | offset |
final int | SCREEN_WIDTH |
The fullscreen dimension for the user's monitor. | |
final int | SCREEN_HEIGHT |
final JFrame | frame |
The fullscreen frame that will be displaying this game. | |
final BufferedImage | BG_IMG |
Image for the game. | |
final BufferedImage | GAMEOVER_IMG |
final BufferedImage[] | COW_IMG |
Animated image for the game. | |
final BufferedImage[] | UFO_C_IMG |
final BufferedImage[] | UFO_S_IMG |
final BufferedImage[] | UFO_T_IMG |
final BufferedImage[] | UFO_X_IMG |
final BufferedImage[] | UFO_Z_IMG |
final Clip[] | MOO_SOUND |
Sounds. | |
final Clip[] | EXPLOSION_SOUND |
final Clip[] | ABDUCT_SOUND |
final Clip[] | WOOSH_SOUND |
final Clip[] | BOOSH_SOUND |
final Vector< Player > | players = new Vector<Player>(4) |
Players for this game are stored here. | |
Static Public Attributes | |
static final float | UFO_WIDTH = .18f |
Proportional dimension of the UFOSprite. | |
static final float | UFO_HEIGHT = .16f |
static final float | COW_WIDTH = .16f |
Proportional dimension of the CowSprite. | |
static final float | COW_HEIGHT = .16f |
Static Package Attributes | |
static final int | MOO_VARIANCE = 5 |
How many of that sound file there is. | |
static final int | EXPLOSION_VARIANCE = 3 |
static final int | ABDUCT_VARIANCE = 1 |
static final int | WOOSH_VARIANCE = 3 |
static final int | BOOSH_VARIANCE = 1 |
static final int | NUM_BUFFERS = 2 |
Number of buffers for page flipping. | |
static final int | MAX_FRAME_SKIPS = 5 |
Maximum allowed frame skips before updates begin to slow down. | |
static final int | DELAYS_PER_YIELD = 16 |
static final long | DESIRED_FPS = 60 |
static final long | PERIOD = 1000000000L / DESIRED_FPS |
Detailed Description
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.
Constructor & Destructor Documentation
Starts a new DemoGame with the given Players.
- Parameters:
-
players the Players for this game.
- Exceptions:
-
Exception if full screen mode is not supported.
Member Function Documentation
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.
Leaves Game Over message on the screen until the ESC key is pressed.
Member Data Documentation
final Clip [] ABDUCT_SOUND |
final int ABDUCT_VARIANCE = 1 [static, package] |
final BufferedImage BG_IMG |
Image for the game.
final Clip [] BOOSH_SOUND |
final int BOOSH_VARIANCE = 1 [static, package] |
final DemoController controller |
The controller for this DemoGame.
final float COW_HEIGHT = .16f [static] |
final BufferedImage [] COW_IMG |
Animated image for the game.
final int DELAYS_PER_YIELD = 16 [static, package] |
final long DESIRED_FPS = 60 [static, package] |
final Clip [] EXPLOSION_SOUND |
final int EXPLOSION_VARIANCE = 3 [static, package] |
final JFrame frame |
The fullscreen frame that will be displaying this game.
final BufferedImage GAMEOVER_IMG |
final int height |
final int MAX_FRAME_SKIPS = 5 [static, package] |
Maximum allowed frame skips before updates begin to slow down.
final Clip [] MOO_SOUND |
Sounds.
final int MOO_VARIANCE = 5 [static, package] |
How many of that sound file there is.
final int NUM_BUFFERS = 2 [static, package] |
Number of buffers for page flipping.
final int offset |
final long PERIOD = 1000000000L / DESIRED_FPS [static, package] |
final int SCREEN_HEIGHT |
final int SCREEN_WIDTH |
The fullscreen dimension for the user's monitor.
final BufferedImage [] UFO_C_IMG |
final float UFO_HEIGHT = .16f [static] |
final BufferedImage [] UFO_S_IMG |
final BufferedImage [] UFO_T_IMG |
final BufferedImage [] UFO_X_IMG |
final BufferedImage [] UFO_Z_IMG |
final int width |
The 4:3 aspect ratio dimension for the user's monitor.
final Clip [] WOOSH_SOUND |
final int WOOSH_VARIANCE = 3 [static, package] |
The documentation for this class was generated from the following file:
- /Users/dev/Documents/SVN brazos.cs.tcu.edu/trunk/FROG/src/frog/demo/DemoGame.java