Class HexGrid
java.lang.Object
HexGrid
HexGrid Class - useful for tile-based games with more flavor!
Inspired from CSRessel's Catan Game & Emmanuel Suriel's Grid class
https://github.com/CSRessel/catan/blob/master/src/gui/CatanBoard.java
Adapted for Processing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidfillOneHex(HexTile hTile) intgetFillColor(HexLocation loc) getHexTile(HexLocation loc) HexTile[][]getMap()intintintgetTileColor(HexLocation loc) intvoidhighlightTile(HexLocation loc) booleanisValid(HexLocation loc) booleanisValidLocation(HexLocation testLoc) booleanisWithinOne(HexLocation loc1, HexLocation loc2) booleanisWithinTwo(HexLocation loc1, HexLocation loc2) voidoutlineOneHex(HexTile hTile) voidRemoves a regular background or moveable background, allowing setColor to work again.voidvoidsetAllOutlinesColor(int outlineColor) voidsetAllTileColors(int tileColor) voidsetAllTileOutlines(int outlineColor) voidsetBackground(processing.core.PImage bgImage) sets the background to imgName.voidsetFillColor(HexLocation loc, int color) intsetTileColor(HexLocation loc, int tileColor) voidsetTileOutlineColor(HexLocation loc, int color)
-
Constructor Details
-
HexGrid
public HexGrid(processing.core.PApplet p, int hexGen) -
HexGrid
public HexGrid(processing.core.PApplet p)
-
-
Method Details
-
isValidLocation
-
isWithinOne
-
isWithinTwo
-
claimHexLocation
-
removeHexLocation
-
displayHexGrid
public void displayHexGrid() -
fillOneHex
-
outlineOneHex
-
setAllTileColors
public void setAllTileColors(int tileColor) -
setAllTileOutlines
public void setAllTileOutlines(int outlineColor) -
getHexTile
-
getTileColor
-
setTileColor
-
highlightTile
-
getMap
-
getNumRows
public int getNumRows() -
getNumCols
public int getNumCols() -
isValid
-
setBackground
public void setBackground(processing.core.PImage bgImage) sets the background to imgName. The img is resized to fit in the grids dimensions. setColor() is disabled- Parameters:
imgName-
-
removeBackground
public void removeBackground()Removes a regular background or moveable background, allowing setColor to work again. -
setFillColor
-
getFillColor
-
setTileOutlineColor
-
getTileOutlineColor
-
setAllOutlinesColor
public void setAllOutlinesColor(int outlineColor)
-