Class Sorting
java.lang.Object
org.openpatch.scratch.extensions.sorting.Sorting
Decides the order in which the sprites of a stage are drawn.
Reached through stage.getSorting():
this.getSorting().byY();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidby(Comparator<? super Sprite> comparator) Draws sprites in an order of your own.voidbyY()Draws sprites that are further down the stage in front of sprites that are further up, which is what a view from above usually wants.Comparator<? super Sprite>Returns the order currently used.booleanisOn()Checks whether the sprites are being sorted.voidoff()Draws sprites in the order they were added, which is the default.
-
Constructor Details
-
Sorting
public Sorting()
-
-
Method Details
-
byY
public void byY()Draws sprites that are further down the stage in front of sprites that are further up, which is what a view from above usually wants. -
by
Draws sprites in an order of your own.- Parameters:
comparator- decides which of two sprites is drawn first
-
off
public void off()Draws sprites in the order they were added, which is the default. -
isOn
public boolean isOn()Checks whether the sprites are being sorted.- Returns:
- true if an order is set
-
getComparator
Returns the order currently used.- Returns:
- the comparator, or null if the sprites are not sorted
-