Package featurecat.lizzie.gui
Class BoardRenderer
- java.lang.Object
-
- featurecat.lizzie.gui.BoardRenderer
-
public class BoardRenderer extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
SHOW_NORMAL_BOARD
static int
SHOW_RAW_BOARD
java.util.Optional<java.util.List<java.lang.String>>
variationOpt
-
Constructor Summary
Constructors Constructor Description BoardRenderer(boolean isMainBoard)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSuggestionAsBranch()
static int[]
availableLength(int boardWidth, int boardHeight, boolean showCoordinates, boolean isMainBoard)
Calculate good values for boardLength, scaledMargin, availableLength, and squareLengthjava.util.Optional<java.lang.String>
bestMoveCoordinateName()
Return the best move of Leelaz's suggestionsvoid
clearBeforeMove()
java.util.Optional<int[]>
convertScreenToCoordinates(int x, int y)
Converts a location on the screen to a location on the boardvoid
draw(java.awt.Graphics2D g)
Draw a go boardvoid
drawEstimateRect(java.util.ArrayList<java.lang.Double> estimateArray, boolean isZen)
void
drawTextureImage(java.awt.Graphics2D g, java.awt.image.BufferedImage img, int x, int y, int width, int height)
Draw texture imageint[]
getActualBoardLength()
int
getDisplayedBranchLength()
boolean
getIsMouseOverSub()
java.awt.Point
getLocation()
int
getReplayBranch()
java.awt.image.BufferedImage
getWallpaper()
void
increaseBestmoveIndexSub(int n)
void
increaseMaxAlpha(int k)
boolean
incrementDisplayedBranchLength(int n)
boolean
isInside(int x1, int y1)
boolean
isShowingBranch()
boolean
isShowingNormalBoard()
boolean
isShowingRawBoard()
java.util.Optional<MoveData>
mouseOveredMove()
void
removeEstimateRect()
static int
roundToInt(double number)
void
setBoardLength(int boardWidth, int boardHeight)
Set the maximum boardLength to render the boardvoid
setBoardParam(int[] param)
void
setClickedSub(boolean status)
void
setDisplayedBranchLength(int n)
void
setIsMouseOverSub(boolean status)
void
setLocation(int x, int y)
Set the location to render the boardvoid
setupSizeParameters()
Calculate good values for boardLength, scaledMargin, availableLength, and squareLengthvoid
startNormalBoard()
-
-
-
Field Detail
-
variationOpt
public java.util.Optional<java.util.List<java.lang.String>> variationOpt
-
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(java.awt.Graphics2D g)
Draw a go board
-
bestMoveCoordinateName
public java.util.Optional<java.lang.String> bestMoveCoordinateName()
Return the best move of Leelaz's suggestions- Returns:
- the optional coordinate name of the best move
-
availableLength
public static int[] availableLength(int boardWidth, int boardHeight, boolean showCoordinates, boolean isMainBoard)
Calculate good values for boardLength, scaledMargin, availableLength, and squareLength
-
setupSizeParameters
public void setupSizeParameters()
Calculate good values for boardLength, scaledMargin, availableLength, and squareLength
-
mouseOveredMove
public java.util.Optional<MoveData> mouseOveredMove()
-
getWallpaper
public java.awt.image.BufferedImage getWallpaper()
-
drawTextureImage
public void drawTextureImage(java.awt.Graphics2D g, java.awt.image.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 java.awt.Point getLocation()
-
setBoardLength
public void setBoardLength(int boardWidth, int boardHeight)
Set the maximum boardLength to render the board
-
setBoardParam
public void setBoardParam(int[] param)
-
getActualBoardLength
public int[] getActualBoardLength()
- Returns:
- the actual board length, including the shadows drawn at the edge of the wooden board
-
convertScreenToCoordinates
public java.util.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
-
isShowingRawBoard
public boolean isShowingRawBoard()
-
isShowingNormalBoard
public boolean isShowingNormalBoard()
-
isShowingBranch
public boolean isShowingBranch()
-
startNormalBoard
public void startNormalBoard()
-
setDisplayedBranchLength
public void setDisplayedBranchLength(int n)
-
getDisplayedBranchLength
public int getDisplayedBranchLength()
-
getReplayBranch
public int getReplayBranch()
-
addSuggestionAsBranch
public void addSuggestionAsBranch()
-
incrementDisplayedBranchLength
public boolean incrementDisplayedBranchLength(int n)
-
isInside
public boolean isInside(int x1, int y1)
-
increaseMaxAlpha
public void increaseMaxAlpha(int k)
-
removeEstimateRect
public void removeEstimateRect()
-
roundToInt
public static int roundToInt(double number)
-
drawEstimateRect
public void drawEstimateRect(java.util.ArrayList<java.lang.Double> estimateArray, boolean isZen)
-
getIsMouseOverSub
public boolean getIsMouseOverSub()
-
setIsMouseOverSub
public void setIsMouseOverSub(boolean status)
-
setClickedSub
public void setClickedSub(boolean status)
-
increaseBestmoveIndexSub
public void increaseBestmoveIndexSub(int n)
-
clearBeforeMove
public void clearBeforeMove()
-
-