Class JigsawPuzzle
java.lang.Object
net.dermetfan.gdx.scenes.scene2d.ui.JigsawPuzzle
represents a puzzle and manages
Pieces- Since:
- 0.10.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(JigsawPuzzle.Piece piece) findClosest(JigsawPuzzle.Piece piece) Deprecated.no known use casecom.badlogic.gdx.utils.Array<JigsawPuzzle.Piece> booleanisSolved(float tolerance) booleanremove(JigsawPuzzle.Piece piece) voidsolve(JigsawPuzzle.Piece relativeTo) solves the puzzle by letting allpiecessnapinto their spotprotected voidsolved()called byplacedwhen all pieces are placed correctly
-
Constructor Details
-
JigsawPuzzle
public JigsawPuzzle() -
JigsawPuzzle
public JigsawPuzzle(int pieces) - Parameters:
pieces- the amount of pieces that will probably be in this puzzle
-
JigsawPuzzle
- Parameters:
pieces- thepieces
-
-
Method Details
-
solve
solves the puzzle by letting allpiecessnapinto their spot- Parameters:
relativeTo- the piece relative to which the puzzle should be solved
-
add
- Parameters:
piece- the piece to add topieces
-
remove
- Parameters:
piece- the piece to remove frompieces- Returns:
- if the piece was found and removed
-
findClosest
Deprecated.no known use case- Parameters:
piece- the piece to which to find the closest other piece- Returns:
- the piece most correctly placed in relation to the given piece
-
isSolved
public boolean isSolved(float tolerance) - Parameters:
tolerance- the distance by which each piece is allowed to be off- Returns:
- if the puzzle is solved
-
solved
protected void solved()called byplacedwhen all pieces are placed correctly -
getPieces
- Returns:
- the
pieces
-