Bandidos
Public Member Functions | List of all members
com.mygdx.game.level.Grid Class Reference

Public Member Functions

 Grid (int gridWidth, int gridHeight, int tileAmountX, int tileAmountY)
 
ArrayList< ArrayList< GridTile > > getAllTiles ()
 
ArrayList< GridTilegetAllTilesInYRow (int yRow)
 
GridTile getTile (int gridXPos, int gridYPos)
 
Vector2 getTileWorldPosition (int gridXPos, int gridYPos)
 
float getTileWidth ()
 
float getTileHeight ()
 
int getTileAmountX ()
 
int getTileAmountY ()
 
float getGridWidth ()
 
float getGridHeight ()
 
void debugRender (RenderComponents renderComponents)
 
void clean ()
 

Detailed Description

This class is used to generate GridTile tiles to form a grid. The class can be cleaned with the 'clean' method

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ Grid()

com.mygdx.game.level.Grid.Grid ( int  gridWidth,
int  gridHeight,
int  tileAmountX,
int  tileAmountY 
)

By calling the constructor the Grid will be generated with the given information.

Parameters
gridWidthis the total width of the grid in pixels
gridHeightis the total height of the grid in pixels
tileAmountXis the amount of tiles which should be generated in the X axis. The width of the tile will be the width of the grid / tileAmountX
tileAmountYis the amount of tiles which should be generated in the Y axis. The height of the tile will be the height of the grid / tileAmountY

Member Function Documentation

◆ clean()

void com.mygdx.game.level.Grid.clean ( )

To clean the class's references. After this method, all references of this class should be nulled and the class should not be used. This method makes the class unusable for future use.

◆ debugRender()

void com.mygdx.game.level.Grid.debugRender ( RenderComponents  renderComponents)

Renders the grid for debugging purposes on the screen.

Parameters
renderComponentsto render the grid with.

◆ getAllTiles()

ArrayList<ArrayList<GridTile> > com.mygdx.game.level.Grid.getAllTiles ( )

Returns all tiles created by this grid.

Returns
All GridTile objects made by this grid.

◆ getAllTilesInYRow()

ArrayList<GridTile> com.mygdx.game.level.Grid.getAllTilesInYRow ( int  yRow)

Returns all tiles created by this grid.

Returns
All GridTile objects made by this grid.

◆ getGridHeight()

float com.mygdx.game.level.Grid.getGridHeight ( )

The height of the entire grid given in the constructor

Returns
The height of the grid.

◆ getGridWidth()

float com.mygdx.game.level.Grid.getGridWidth ( )

The width of the entire grid given in the constructor

Returns
The width of the grid.

◆ getTile()

GridTile com.mygdx.game.level.Grid.getTile ( int  gridXPos,
int  gridYPos 
)

Gets the tile with the same x and y index.

Parameters
gridXPosis the index of the tile's x axis
gridYPosis the index of the tile's y axis
Returns
The tile on the given indexes. If the indexes are out of bounds, this will return 'null'

◆ getTileAmountX()

int com.mygdx.game.level.Grid.getTileAmountX ( )

Gets the amount of tiles in the x axis given in the constructor.

Returns
The amount of tiles in the x axis

◆ getTileAmountY()

int com.mygdx.game.level.Grid.getTileAmountY ( )

Gets the amount of tiles in the y axis given in the constructor

Returns
The amount of tiles in the y axis

◆ getTileHeight()

float com.mygdx.game.level.Grid.getTileHeight ( )

Gets the tile height (The height of the tile will be the height of the grid / tileAmountY)

Returns
The height of a tile in pixels

◆ getTileWidth()

float com.mygdx.game.level.Grid.getTileWidth ( )

Gets the tile width (The width of the tile will be the width of the grid / tileAmountX)

Returns
The width of a tile in pixels

◆ getTileWorldPosition()

Vector2 com.mygdx.game.level.Grid.getTileWorldPosition ( int  gridXPos,
int  gridYPos 
)

Returns the world position of tile location given.

Parameters
gridXPosis the index of the tile's x axis
gridYPosis the index of the tile's y axis
Returns
The world position of the given tile (The left down corner of it)

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