Main Page   Packages   Alphabetical List   Compound List   File List   Compound Members  

GameCanvas Class Reference

List of all members.

Detailed Description

This class is derived from a MIDlet canvas.

It contains the main functionality of the game. It does three things basically

  1. Contains A GameBoard, which contains the game primitives and drawing code.
  2. Runs a FrameTrigger, which spawns a thread to periodically update the frames.
  3. Listens for key-presses, and notifies apropriate objects in the gameboard.


Public Member Functions

 GameCanvas (pacman midlet, int level, int score, int lives)
 Constructor.

void unPause ()
void advanceFrame ()
 This function is called periodically by FrameTrigger.

void commandAction (Command c, Displayable s)
 Respond to a command issued on the canvas.


Public Attributes

GameBoard gameBoard_
 The game board contains the game primitives, logic, and drawing code.

FrameTrigger frameTrigger_
 frameTrigger object is responsible for periodically calling back to this object to trigger a frame update.


Protected Member Functions

void paint (Graphics g)
 Called by the system to repaint the screen.

void keyPressed (int keyCode)
 This function is called by the system when the user presses a key.


Private Attributes

final pacman midlet
final Command exitCommand
final Command menuCommand
final int level


Constructor & Destructor Documentation

GameCanvas.GameCanvas pacman  midlet,
int  level,
int  score,
int  lives
 

Constructor.

Parameters:
disp The display where the game should run.


Member Function Documentation

void GameCanvas.advanceFrame  ) 
 

This function is called periodically by FrameTrigger.

It simply tells the gameboard to advance it's logic by one frame, then it requests a repaint from the system.

void GameCanvas.commandAction Command  c,
Displayable  s
 

Respond to a command issued on the canvas.

void GameCanvas.keyPressed int  keyCode  )  [protected]
 

This function is called by the system when the user presses a key.

Parameters:
keyCode The unique int value of the key being pressed'
Modified: 3/4/03 : Paul Force Changed to use a more general key binding. Should work on any phone now

void GameCanvas.paint Graphics  g  )  [protected]
 

Called by the system to repaint the screen.

Parameters:
g Graphics object where drawing should take place.

void GameCanvas.unPause  ) 
 


Member Data Documentation

final Command GameCanvas.exitCommand [private]
 

FrameTrigger GameCanvas.frameTrigger_
 

frameTrigger object is responsible for periodically calling back to this object to trigger a frame update.

GameBoard GameCanvas.gameBoard_
 

The game board contains the game primitives, logic, and drawing code.

This object is created during construction.

final int GameCanvas.level [private]
 

final Command GameCanvas.menuCommand [private]
 

final pacman GameCanvas.midlet [private]
 


The documentation for this class was generated from the following file:
Generated on Tue May 13 00:53:02 2003 for PACMAN by doxygen1.3