Class JigsawPuzzle.Piece
java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.ui.Widget
com.badlogic.gdx.scenes.scene2d.ui.Image
net.dermetfan.gdx.scenes.scene2d.ui.JigsawPuzzle.Piece
- All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Layout
- Enclosing class:
- JigsawPuzzle
public static class JigsawPuzzle.Piece
extends com.badlogic.gdx.scenes.scene2d.ui.Image
a piece on a
JigsawPuzzle- Since:
- 0.10.0
-
Constructor Summary
Constructors Constructor Description Piece(com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable) -
Method Summary
Modifier and Type Method Description floatgetSlotX()floatgetSlotY()com.badlogic.gdx.scenes.scene2d.Actorhit(float x, float y, boolean touchable)booleanisPlacedCorrectly(JigsawPuzzle.Piece reference, float tolerance)voidplace(JigsawPuzzle.Piece reference)voidsetDrawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable)voidsetSlot(float slotX, float slotY)voidsetSlotX(float slotX)voidsetSlotY(float slotY)Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Image
draw, getAlign, getDrawable, getImageHeight, getImageWidth, getImageX, getImageY, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, layout, setAlign, setDrawable, setScaling, toStringMethods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget
getMaxHeight, getMaxWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateMethods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
act, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFrontMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Piece
public Piece(com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable)
-
-
Method Details
-
setDrawable
public void setDrawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable)- Overrides:
setDrawablein classcom.badlogic.gdx.scenes.scene2d.ui.Image- Parameters:
drawable- Sets theslotto the drawable'spolygonXandpolygonYif the given drawable is aPolygonRegionDrawable. Otherwise sets it to 0:0.
-
hit
public com.badlogic.gdx.scenes.scene2d.Actor hit(float x, float y, boolean touchable)- Overrides:
hitin classcom.badlogic.gdx.scenes.scene2d.Actor
-
place
- Parameters:
reference- the piece in relation to which to this piece should snap in its spot
-
isPlacedCorrectly
- Parameters:
reference- the piece in relation to which this piece's position should be checkedtolerance- the distance by which each piece is allowed to be off- Returns:
- if this piece is placed correctly in relation to the given reference piece with the given tolerance
-
setSlot
public void setSlot(float slotX, float slotY)- Parameters:
slotX- theslotXto setslotY- theslotYto set
-
getSlotX
public float getSlotX()- Returns:
- the
slotX
-
setSlotX
public void setSlotX(float slotX)- Parameters:
slotX- theslotXto set
-
getSlotY
public float getSlotY()- Returns:
- the
slotY
-
setSlotY
public void setSlotY(float slotY)- Parameters:
slotY- theslotYto set
-