Class CellComponent

java.lang.Object
webb.client.ui.screens.puzzlescreen.CellComponent

public class CellComponent extends Object
This class represents a single cell in the puzzle grid. Allows us to not deal with coordinates and just use row and col. This class handles the drawing of the cell logic class.
  • Constructor Details

    • CellComponent

      public CellComponent(int col, int row)
      Create a new cell
      Parameters:
      col - Column of the cell
      row - Row of the cell
  • Method Details

    • isInside

      protected boolean isInside(double x, double y)
      Checks to see if the mouse cords are inside the cell
      Parameters:
      x - X cord of the mouse
      y - Y cord of the mouse
      Returns:
      True if the mouse is inside the cell
    • onClick

      public void onClick(boolean rightClick)
      Called when the cell is clicked
      Parameters:
      rightClick - True if the right mouse button was clicked
    • getLogic

      public CellLogic getLogic()
      Get the logic data for the cell
      Returns:
      the logic data class
    • draw

      protected void draw(Graphics2D g2d)
      Draw the image for the cell, given the cell type
      Parameters:
      g2d - Graphics2D object to draw with
    • setBounds

      protected void setBounds(double x, double y, double width, double height)
      Set the bounds of the cell when we repaint the scene This is used so we can easily calculate if the mouse is inside the cell
      Parameters:
      x - X cord of the cell
      y - Y cord of the cell
      width - Width of the cell
      height - Height of the cell
    • getGroup

      public int getGroup()
    • setWall

      public void setWall(int wall)
    • getType

      public CellType getType()
    • setGroup

      public void setGroup(int group)
    • setType

      public void setType(CellType type)
    • getRow

      public int getRow()
    • getCol

      public int getCol()
    • setSolutionStar

      public void setSolutionStar()
    • isSolutionStar

      public boolean isSolutionStar()