Class Bucket

All Implemented Interfaces:
com.badlogic.gdx.InputProcessor, com.badlogic.gdx.utils.Pool.Poolable, ShortcutAdapter, Tool

public final class Bucket extends EditorTool
The Bucket class represents a tool for filling areas with a selected tile in an editor application. It extends the EditorTool class and provides methods for validating, handling touch events, marking tiles, and resetting the tool.
  • Constructor Details

    • Bucket

      public Bucket()
  • Method Details

    • validate

      public void validate()
      Description copied from interface: Tool
      Validates the current state of the tool. This method is called internally to ensure the tool is in a valid state. It performs necessary validations and updates to the tool's internal state.
      Specified by:
      validate in interface Tool
      Overrides:
      validate in class EditorTool
    • touchDown

      public boolean touchDown(int screenX, int screenY, int pointer, int button)
      Description copied from class: EditorTool
      Handles the touch down event in the editor.
      Specified by:
      touchDown in interface com.badlogic.gdx.InputProcessor
      Overrides:
      touchDown in class EditorTool
      Parameters:
      screenX - The x coordinate of the touch position
      screenY - The y coordinate of the touch position
      pointer - The pointer for the event
      button - The button that was pressed
      Returns:
      true if the touch event is handled, false otherwise
    • markTile

      protected void markTile(com.badlogic.gdx.math.GridPoint2 gridPoint) throws InvalidGridCellException
      Marks the tile located at the given grid point.
      Specified by:
      markTile in class EditorTool
      Parameters:
      gridPoint - the grid point representing the tile to be marked
      Throws:
      InvalidGridCellException - if an invalid grid cell is accessed
    • touchUp

      public boolean touchUp(int screenX, int screenY, int pointer, int button)
      Specified by:
      touchUp in interface com.badlogic.gdx.InputProcessor
      Overrides:
      touchUp in class EditorTool
    • touchDragged

      public boolean touchDragged(int screenX, int screenY, int pointer)
      Description copied from class: EditorTool
      Handles the touch dragged event in the editor.
      Specified by:
      touchDragged in interface com.badlogic.gdx.InputProcessor
      Overrides:
      touchDragged in class EditorTool
      Parameters:
      screenX - The x coordinate of the touch position
      screenY - The y coordinate of the touch position
      pointer - The pointer for the event
      Returns:
      true if the touch event is handled, false otherwise
    • reset

      public void reset()
      Description copied from class: EditorTool
      Resets the state of the tool.

      This method is responsible for resetting the tool to its initial state by setting the canvas field to null, and clearing the lastPosition and lastGridPosition fields.

      Specified by:
      reset in interface com.badlogic.gdx.utils.Pool.Poolable
      Overrides:
      reset in class EditorTool