Package de.tum.cit.ase.editor.tools
Class Bucket
java.lang.Object
de.tum.cit.ase.editor.input.ToolInputAdapter
de.tum.cit.ase.editor.tools.EditorTool
de.tum.cit.ase.editor.tools.Bucket
- All Implemented Interfaces:
com.badlogic.gdx.InputProcessor,com.badlogic.gdx.utils.Pool.Poolable,ShortcutAdapter,Tool
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.
-
Field Summary
Fields inherited from class de.tum.cit.ase.editor.tools.EditorTool
bresenham2, canvas, lastGridPosition, lastPositionFields inherited from interface de.tum.cit.ase.editor.input.ShortcutAdapter
pressedKeys -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidmarkTile(com.badlogic.gdx.math.GridPoint2 gridPoint) Marks the tile located at the given grid point.voidreset()Resets the state of the tool.booleantouchDown(int screenX, int screenY, int pointer, int button) Handles the touch down event in the editor.booleantouchDragged(int screenX, int screenY, int pointer) Handles the touch dragged event in the editor.booleantouchUp(int screenX, int screenY, int pointer, int button) voidvalidate()Validates the current state of the tool.Methods inherited from class de.tum.cit.ase.editor.tools.EditorTool
draw, getGrid, getInstance, getLine, getStraightLineCoordinates, isStraightLine, projectGridPointToWorld, projectGridPointToWorldMethods inherited from class de.tum.cit.ase.editor.input.ToolInputAdapter
keyDown, keyTyped, keyUp, mouseMoved, scrolled, touchCancelledMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.tum.cit.ase.editor.input.ShortcutAdapter
addKey, isShortcut, isShortcut, isShortcut, removeKey
-
Constructor Details
-
Bucket
public Bucket()
-
-
Method Details
-
validate
public void validate()Description copied from interface:ToolValidates 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:
validatein interfaceTool- Overrides:
validatein classEditorTool
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button) Description copied from class:EditorToolHandles the touch down event in the editor.- Specified by:
touchDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDownin classEditorTool- Parameters:
screenX- The x coordinate of the touch positionscreenY- The y coordinate of the touch positionpointer- The pointer for the eventbutton- The button that was pressed- Returns:
trueif the touch event is handled,falseotherwise
-
markTile
Marks the tile located at the given grid point.- Specified by:
markTilein classEditorTool- 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:
touchUpin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchUpin classEditorTool
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer) Description copied from class:EditorToolHandles the touch dragged event in the editor.- Specified by:
touchDraggedin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDraggedin classEditorTool- Parameters:
screenX- The x coordinate of the touch positionscreenY- The y coordinate of the touch positionpointer- The pointer for the event- Returns:
trueif the touch event is handled,falseotherwise
-
reset
public void reset()Description copied from class:EditorToolResets the state of the tool.This method is responsible for resetting the tool to its initial state by setting the
canvasfield tonull, and clearing thelastPositionandlastGridPositionfields.- Specified by:
resetin interfacecom.badlogic.gdx.utils.Pool.Poolable- Overrides:
resetin classEditorTool
-