Package featurecat.lizzie.gui
Class BoardRenderer
- java.lang.Object
-
- featurecat.lizzie.gui.BoardRenderer
-
public class BoardRenderer extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intSHOW_NORMAL_BOARDstatic intSHOW_RAW_BOARDOptional<List<String>>variationOpt
-
Constructor Summary
Constructors Constructor Description BoardRenderer(boolean isMainBoard)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>bestMoveCoordinateName()Return the best move of Leelaz's suggestionsOptional<int[]>convertScreenToCoordinates(int x, int y)Converts a location on the screen to a location on the boardvoiddraw(Graphics2D g)Draw a go boardvoiddrawTextureImage(Graphics2D g, BufferedImage img, int x, int y, int width, int height)Draw texture imageintgetActualBoardLength()PointgetLocation()BufferedImagegetWallpaper()voidincreaseMaxAlpha(int k)booleanincrementDisplayedBranchLength(int n)booleanisInside(int x1, int y1)booleanisShowingBranch()voidsetBoardLength(int boardLength)Set the maximum boardLength to render the boardvoidsetDisplayedBranchLength(int n)voidsetLocation(int x, int y)Set the location to render the board
-
-
-
Field Detail
-
SHOW_RAW_BOARD
public static final int SHOW_RAW_BOARD
- See Also:
- Constant Field Values
-
SHOW_NORMAL_BOARD
public static final int SHOW_NORMAL_BOARD
- See Also:
- Constant Field Values
-
-
Method Detail
-
draw
public void draw(Graphics2D g)
Draw a go board
-
bestMoveCoordinateName
public Optional<String> bestMoveCoordinateName()
Return the best move of Leelaz's suggestions- Returns:
- the optional coordinate name of the best move
-
getWallpaper
public BufferedImage getWallpaper()
-
drawTextureImage
public void drawTextureImage(Graphics2D g, BufferedImage img, int x, int y, int width, int height)
Draw texture image
-
setLocation
public void setLocation(int x, int y)Set the location to render the board- Parameters:
x- x coordinatey- y coordinate
-
getLocation
public Point getLocation()
-
setBoardLength
public void setBoardLength(int boardLength)
Set the maximum boardLength to render the board- Parameters:
boardLength- the boardLength of the board
-
getActualBoardLength
public int getActualBoardLength()
- Returns:
- the actual board length, including the shadows drawn at the edge of the wooden board
-
convertScreenToCoordinates
public Optional<int[]> convertScreenToCoordinates(int x, int y)
Converts a location on the screen to a location on the board- Parameters:
x- x pixel coordinatey- y pixel coordinate- Returns:
- if there is a valid coordinate, an array (x, y) where x and y are between 0 and BOARD_SIZE - 1. Otherwise, returns Optional.empty
-
isShowingBranch
public boolean isShowingBranch()
-
setDisplayedBranchLength
public void setDisplayedBranchLength(int n)
-
incrementDisplayedBranchLength
public boolean incrementDisplayedBranchLength(int n)
-
isInside
public boolean isInside(int x1, int y1)
-
increaseMaxAlpha
public void increaseMaxAlpha(int k)
-
-