SnakeGame  1
Implementing a game of Snake
 All Classes Functions Variables Pages
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
com.gradescope.spampede.SpampedeDisplay Class Reference

SpampedeBrain - The "View" in MVC. More...

Public Member Functions

 SpampedeDisplay (SpampedeData theBoardInput, Graphics theScreenInput, int widthInput, int heightInput)
 Constructor. More...
 
void drawSquare (int x, int y, Color cellColor)
 Draws a cell-sized square with its upper-left corner at the given pixel coordinates (i.e., x pixels to the right and y pixels below the upper-left corner) on the display. More...
 
void displayTitle ()
 Displays the title of the game.
 
void displayGameOver ()
 Displays the game-over message.
 
void displaySnakeCount (int count)
 Displays the snake eaten count.
 
void displayLives (int lives)
 Displays the lives remaining.
 
 SpampedeDisplay (SpampedeData theBoardInput, Graphics theScreenInput, int widthInput, int heightInput)
 Constructor. More...
 
void drawSquare (int x, int y, Color cellColor)
 Draws a cell-sized square with its upper-left corner at the given pixel coordinates (i.e., x pixels to the right and y pixels below the upper-left corner) on the display. More...
 
void displayTitle ()
 Displays the title of the game.
 
void displayGameOver ()
 Displays the game-over message.
 
void displaySnakeCount (int count)
 Displays the snake eaten count.
 
void displayLives (int lives)
 Displays the lives remaining.
 

Static Public Attributes

static Image imageSpam
 a picture of a can of spam
 

Private Attributes

SpampedeData theData
 reference to the board/spampede data being drawn
 
Graphics theScreen
 the display where the board is drawn
 
int width
 width of the display in pixels
 
int height
 height of the display in pixels
 

Detailed Description

SpampedeBrain - The "View" in MVC.

Author
Max Treutelaar
CS60 instructors

Constructor & Destructor Documentation

com.gradescope.spampede.SpampedeDisplay.SpampedeDisplay ( SpampedeData  theBoardInput,
Graphics  theScreenInput,
int  widthInput,
int  heightInput 
)

Constructor.

Parameters
theBoardInputthe data being displayed
theScreenInputthe display to draw the board
widthInputwidth of the display (in pixels)
heightInputheight of the display (in pixels)
com.gradescope.spampede.SpampedeDisplay.SpampedeDisplay ( SpampedeData  theBoardInput,
Graphics  theScreenInput,
int  widthInput,
int  heightInput 
)

Constructor.

Parameters
theBoardInputthe data being displayed
theScreenInputthe display to draw the board
widthInputwidth of the display (in pixels)
heightInputheight of the display (in pixels)

Member Function Documentation

void com.gradescope.spampede.SpampedeDisplay.drawSquare ( int  x,
int  y,
Color  cellColor 
)

Draws a cell-sized square with its upper-left corner at the given pixel coordinates (i.e., x pixels to the right and y pixels below the upper-left corner) on the display.

Parameters
xx-coordinate of the square, between 0 and this.width-1 inclusive
yy-coordinate of the square, between 0 and this.width-1 inclusive
cellColorcolor of the square being drawn
void com.gradescope.spampede.SpampedeDisplay.drawSquare ( int  x,
int  y,
Color  cellColor 
)

Draws a cell-sized square with its upper-left corner at the given pixel coordinates (i.e., x pixels to the right and y pixels below the upper-left corner) on the display.

Parameters
xx-coordinate of the square, between 0 and this.width-1 inclusive
yy-coordinate of the square, between 0 and this.width-1 inclusive
cellColorcolor of the square being drawn

The documentation for this class was generated from the following file: