Bridges-Java
3.4.3
Bridges(Java API)
|
This class in BRIDGES is part of the BRIDGS Game API. It is for representing an (m x n) game grid. Each position in the grid will hold a GameCell object, each of which has a foreground color, background color, and a symbol.
The API supports 2D nonblocking games
Public Member Functions | |
void | setEncoding (String encoding) |
Enable changing the game grid encoding when building JSON representation. More... | |
String | getDataStructType () |
Get the data structure type (string) More... | |
GameGrid () | |
GameGrid (int rows, int cols) | |
void | setBGColor (Integer row, Integer col, NamedColor color) |
NamedColor | getBGColor (Integer row, Integer col) |
NamedSymbol | getSymbol (Integer row, Integer col) |
NamedColor | getSymbolColor (Integer row, Integer col) |
void | setFGColor (Integer row, Integer col, NamedColor color) |
void | setBGColor (Integer row, Integer col, String color) |
void | setFGColor (Integer row, Integer col, String color) |
void | drawSymbol (Integer row, Integer col, Integer symbol) |
void | drawSymbol (Integer row, Integer col, NamedSymbol symbol) |
void | drawSymbol (Integer row, Integer col, Integer symbol, String color) |
void | drawSymbol (Integer row, Integer col, NamedSymbol symbol, String color) |
void | drawSymbol (Integer row, Integer col, Integer symbol, NamedColor color) |
void | drawSymbol (Integer row, Integer col, NamedSymbol symbol, NamedColor color) |
String | getDataStructureRepresentation () |
Public Member Functions inherited from bridges.base.Grid< GameCell > | |
String | getDataStructType () |
Grid () | |
Grid (int size) | |
Grid (int rows, int cols) | |
Construct a rows x cols size grid. More... | |
Grid (int[] size) | |
Construct a size[0] by size[1] sized grid. More... | |
void | resize (int rows, int cols) |
int[] | getDimensions () |
Get the grid dimensions. More... | |
E | get (Integer row, Integer col) |
Get the (row, col) element in the grid. More... | |
void | set (Integer row, Integer col, E val) |
String | getDataStructureRepresentation () |
Get data structure representation. More... | |
Package Attributes | |
ByteBuffer | bf_bg |
ByteBuffer | bf_fg |
ByteBuffer | bf_symbols |
String | encoding = "raw" |
Additional Inherited Members | |
Protected Attributes inherited from bridges.base.Grid< GameCell > | |
ArrayList< ArrayList< E > > | grid |
int[] | gridSize |
Static Protected Attributes inherited from bridges.base.Grid< GameCell > | |
static final int[] | defaultGridSize |
static int[] | maxGridSize |
bridges.base.GameGrid.GameGrid | ( | ) |
Default Game Grid constructor Default size is 10 by 10
bridges.base.GameGrid.GameGrid | ( | int | rows, |
int | cols | ||
) |
Grid constructor with grid size arguments
rows | - int representing the number of rows of the grid |
cols | - int representing the number of columns of the grid |
void bridges.base.GameGrid.drawSymbol | ( | Integer | row, |
Integer | col, | ||
Integer | symbol | ||
) |
Draw a symbol at the specified location
row,col | - integer indices specifying the position to modify |
symbol | - Integer symbol argument to set the symbol at the chosen position |
void bridges.base.GameGrid.drawSymbol | ( | Integer | row, |
Integer | col, | ||
Integer | symbol, | ||
NamedColor | color | ||
) |
Draw a symbol at the specified location
row,col | - integer indices specifying the position to modify |
symbol | - Integer symbol argument to set the symbol at the chosen position |
color | - Named Color enum argument to set the foreground at the chosen position |
void bridges.base.GameGrid.drawSymbol | ( | Integer | row, |
Integer | col, | ||
Integer | symbol, | ||
String | color | ||
) |
Draw a symbol at the specified location
row,col | - integer indices specifying the position to modify |
symbol | - Integer symbol argument to set the symbol at the chosen position |
color | - String color argument to set the background at the chosen position |
void bridges.base.GameGrid.drawSymbol | ( | Integer | row, |
Integer | col, | ||
NamedSymbol | symbol | ||
) |
Draw a symbol at the specified location
row,col | - integer indices specifying the position to modify |
symbol | - Named symbol enum argument to set the symbol at the chosen position |
void bridges.base.GameGrid.drawSymbol | ( | Integer | row, |
Integer | col, | ||
NamedSymbol | symbol, | ||
NamedColor | color | ||
) |
void bridges.base.GameGrid.drawSymbol | ( | Integer | row, |
Integer | col, | ||
NamedSymbol | symbol, | ||
String | color | ||
) |
Draw a symbol at the specified location
row,col | - integer indices specifying the position to modify |
symbol | - Named Symbol enum argument to set the symbol at the chosen position |
color | - String color argument to set the background at the chosen position |
NamedColor bridges.base.GameGrid.getBGColor | ( | Integer | row, |
Integer | col | ||
) |
Get background color of a cell
row,col | - integer indices specifying the position |
String bridges.base.GameGrid.getDataStructType | ( | ) |
Get the data structure type (string)
String bridges.base.GameGrid.getDataStructureRepresentation | ( | ) |
get the JSON representation of the game grid. Contains separate foreground, background, and symbol arrays
NamedSymbol bridges.base.GameGrid.getSymbol | ( | Integer | row, |
Integer | col | ||
) |
Get symbol at a cell
row,col | - integer indices specifying the position |
NamedColor bridges.base.GameGrid.getSymbolColor | ( | Integer | row, |
Integer | col | ||
) |
Get symbol color of a cell
row,col | - integer indices specifying the position |
void bridges.base.GameGrid.setBGColor | ( | Integer | row, |
Integer | col, | ||
NamedColor | color | ||
) |
Set background color of a cell using an enum argument
row,col | - integer indices specifying the position to modify |
color | - Named Color enum argument to set the background at the chosen position |
void bridges.base.GameGrid.setBGColor | ( | Integer | row, |
Integer | col, | ||
String | color | ||
) |
Set background color of a cell using an enum argument
row,col | - integer indices specifying the position to modify |
color | - String color argument to set the background at the chosen position |
void bridges.base.GameGrid.setEncoding | ( | String | encoding | ) |
Enable changing the game grid encoding when building JSON representation.
encoding | type of encoding. Supports "raw" and "rle" |
void bridges.base.GameGrid.setFGColor | ( | Integer | row, |
Integer | col, | ||
NamedColor | color | ||
) |
Set foreground color of a cell using an enum argument
row,col | - integer indices specifying the position to modify |
color | - Named Color enum argument to set the foreground at the chosen position |
void bridges.base.GameGrid.setFGColor | ( | Integer | row, |
Integer | col, | ||
String | color | ||
) |
Set foreground color of a cell using an enum argument
row,col | - integer indices specifying the position to modify |
color | - String color argument to set the foreground at the chosen position |
|
package |
|
package |
|
package |
|
package |