Bridges-Java  3.4.3
Bridges(Java API)
Public Member Functions | Protected Member Functions | Protected Attributes | Package Functions | List of all members
bridges.games.GameBase Class Referenceabstract
Inheritance diagram for bridges.games.GameBase:
bridges.games.BlockingGame bridges.games.NonBlockingGame

Public Member Functions

 GameBase (int assid, String login, String apikey, int rows, int cols)
 
 GameBase (int assid, String login, String apikey, int rows, int cols, boolean d)
 
abstract void start ()
 Call this function from main to start the game. More...
 

Protected Member Functions

abstract void initialize ()
 This function is called once when the game starts. More...
 
abstract void gameLoop ()
 This function is called once per frame of the game. More...
 
void quit ()
 Call this function to stop the game. More...
 
void setTitle (String title)
 Set the title of the game. More...
 
void setDescription (String desc)
 Set a short description of the game. More...
 
void setBGColor (int row, int col, NamedColor c)
 Change the background color of a cell. More...
 
NamedColor getBGColor (int row, int col)
 What color is this cell? More...
 
NamedSymbol getSymbol (int row, int col)
 What object is in this cell? More...
 
NamedColor getSymbolColor (int row, int col)
 What color is object in this cell? More...
 
void drawSymbol (int row, int col, NamedSymbol s, NamedColor c)
 Draw a symbol on the game. More...
 
int getBoardWidth ()
 How wide is the Game Board? More...
 
int getBoardHeight ()
 How tall is the Game Board? More...
 
void terminateNetwork ()
 terminal all network connections Note that it takes a minute for all threads to gracefully exit More...
 

Protected Attributes

boolean debug = false
 
boolean gameStarted = true
 

Package Functions

void registerKeypress (KeypressListener kl)
 register a new KeypressListener More...
 
void render ()
 Renders the game. More...
 

Constructor & Destructor Documentation

◆ GameBase() [1/2]

bridges.games.GameBase.GameBase ( int  assid,
String  login,
String  apikey,
int  rows,
int  cols 
)

◆ GameBase() [2/2]

bridges.games.GameBase.GameBase ( int  assid,
String  login,
String  apikey,
int  rows,
int  cols,
boolean  d 
)

Member Function Documentation

◆ drawSymbol()

void bridges.games.GameBase.drawSymbol ( int  row,
int  col,
NamedSymbol  s,
NamedColor  c 
)
protected

Draw a symbol on the game.

Parameters
row- row of the cell to draw the object on
col- column of the cell to draw the object on
ssymbol representing the object
ccolor of the object

◆ gameLoop()

abstract void bridges.games.GameBase.gameLoop ( )
abstractprotected

This function is called once per frame of the game.

Students write this function. It will be called at each frame of the game.

◆ getBGColor()

NamedColor bridges.games.GameBase.getBGColor ( int  row,
int  col 
)
protected

What color is this cell?

Parameters
row- row of the cell
col- column of the cell

◆ getBoardHeight()

int bridges.games.GameBase.getBoardHeight ( )
protected

How tall is the Game Board?

Returns
the number of rows of the board

◆ getBoardWidth()

int bridges.games.GameBase.getBoardWidth ( )
protected

How wide is the Game Board?

Returns
the number of columns of the board

◆ getSymbol()

NamedSymbol bridges.games.GameBase.getSymbol ( int  row,
int  col 
)
protected

What object is in this cell?

Parameters
row- row of the cell
col- column of the cell

◆ getSymbolColor()

NamedColor bridges.games.GameBase.getSymbolColor ( int  row,
int  col 
)
protected

What color is object in this cell?

Parameters
row- row of the cell
col- column of the cell

◆ initialize()

abstract void bridges.games.GameBase.initialize ( )
abstractprotected

This function is called once when the game starts.

Students write this function. It will be called once at the begining of the game.

◆ quit()

void bridges.games.GameBase.quit ( )
protected

Call this function to stop the game.

◆ registerKeypress()

void bridges.games.GameBase.registerKeypress ( KeypressListener  kl)
package

register a new KeypressListener

Students should not have to call this function directly. The KeypressListener listener will get notified of all keypresses (up and down) that happens in the game.

Parameters
kla KeypressListener to register

◆ render()

void bridges.games.GameBase.render ( )
package

Renders the game.

Student should not have to call this function directly. It is called automatically by Bridges.

◆ setBGColor()

void bridges.games.GameBase.setBGColor ( int  row,
int  col,
NamedColor  c 
)
protected

Change the background color of a cell.

Parameters
row- row of the cell to set
col- column of the cell to set
cNamedColor to set

◆ setDescription()

void bridges.games.GameBase.setDescription ( String  desc)
protected

Set a short description of the game.

Parameters
descDescription of the game

◆ setTitle()

void bridges.games.GameBase.setTitle ( String  title)
protected

Set the title of the game.

Parameters
titleTitle of the game

◆ start()

abstract void bridges.games.GameBase.start ( )
abstract

Call this function from main to start the game.

Reimplemented in bridges.games.NonBlockingGame, and bridges.games.BlockingGame.

◆ terminateNetwork()

void bridges.games.GameBase.terminateNetwork ( )
protected

terminal all network connections Note that it takes a minute for all threads to gracefully exit

Member Data Documentation

◆ debug

boolean bridges.games.GameBase.debug = false
protected

◆ gameStarted

boolean bridges.games.GameBase.gameStarted = true
protected

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